49
49
map_type_from_supertype , bind_self , erase_to_bound , make_simplified_union ,
50
50
erase_def_to_union_or_bound , erase_to_union_or_bound , coerce_to_literal ,
51
51
try_getting_str_literals_from_type , try_getting_int_literals_from_type ,
52
- tuple_fallback , is_singleton_type , try_expanding_enum_to_union ,
52
+ tuple_fallback , is_singleton_type , try_expanding_sum_type_to_union ,
53
53
true_only , false_only , function_type , get_type_vars , custom_special_method ,
54
54
is_literal_type_like ,
55
55
)
@@ -4481,6 +4481,7 @@ def refine_identity_comparison_expression(self,
4481
4481
4482
4482
target = None # type: Optional[Type]
4483
4483
possible_target_indices = []
4484
+
4484
4485
for i in chain_indices :
4485
4486
expr_type = operand_types [i ]
4486
4487
if should_coerce :
@@ -4534,11 +4535,11 @@ def refine_identity_comparison_expression(self,
4534
4535
if singleton_index == - 1 :
4535
4536
singleton_index = possible_target_indices [- 1 ]
4536
4537
4537
- enum_name = None
4538
+ sum_type_name = None
4538
4539
target = get_proper_type (target )
4539
4540
if (isinstance (target , LiteralType ) and
4540
4541
(target .is_enum_literal () or target .fallback .type .fullname == "builtins.bool" )):
4541
- enum_name = target .fallback .type .fullname
4542
+ sum_type_name = target .fallback .type .fullname
4542
4543
4543
4544
target_type = [TypeRange (target , is_upper_bound = False )]
4544
4545
@@ -4559,8 +4560,8 @@ def refine_identity_comparison_expression(self,
4559
4560
expr = operands [i ]
4560
4561
expr_type = coerce_to_literal (operand_types [i ])
4561
4562
4562
- if enum_name is not None :
4563
- expr_type = try_expanding_enum_to_union (expr_type , enum_name )
4563
+ if sum_type_name is not None :
4564
+ expr_type = try_expanding_sum_type_to_union (expr_type , sum_type_name )
4564
4565
4565
4566
# We intentionally use 'conditional_type_map' directly here instead of
4566
4567
# 'self.conditional_type_map_with_intersection': we only compute ad-hoc
0 commit comments