@@ -1454,9 +1454,6 @@ def visit_index_expr_helper(self, e: IndexExpr) -> Type:
1454
1454
return AnyType ()
1455
1455
elif isinstance (left_type , TypedDictType ):
1456
1456
return self .visit_typeddict_index_expr (left_type , e .index )
1457
- elif (isinstance (left_type , CallableType )
1458
- and left_type .is_type_obj () and left_type .type_object ().is_enum ):
1459
- return self .visit_enum_index_expr (left_type .type_object (), e .index , e )
1460
1457
else :
1461
1458
result , method_type = self .check_op ('__getitem__' , left_type , e .index , e )
1462
1459
e .method_type = method_type
@@ -1515,16 +1512,6 @@ def visit_typeddict_index_expr(self, td_type: TypedDictType, index: Expression)
1515
1512
return AnyType ()
1516
1513
return item_type
1517
1514
1518
- def visit_enum_index_expr (self , enum_type : TypeInfo , index : Expression ,
1519
- context : Context ) -> Type :
1520
- string_type = self .named_type ('builtins.str' ) # type: Type
1521
- if self .chk .options .python_version [0 ] < 3 :
1522
- string_type = UnionType .make_union ([string_type ,
1523
- self .named_type ('builtins.unicode' )])
1524
- self .chk .check_subtype (self .accept (index ), string_type , context ,
1525
- "Enum index should be a string" , "actual index type" )
1526
- return Instance (enum_type , [])
1527
-
1528
1515
def visit_cast_expr (self , expr : CastExpr ) -> Type :
1529
1516
"""Type check a cast expression."""
1530
1517
source_type = self .accept (expr .expr , type_context = AnyType ())
0 commit comments