@@ -4037,8 +4037,8 @@ def analyze_alias(
40374037 variadic = True
40384038 new_tvar_defs .append (td )
40394039
4040- empty_tuple_index = typ . empty_tuple_index if isinstance (typ , UnboundType ) else False
4041- return analyzed , new_tvar_defs , depends_on , empty_tuple_index
4040+ indexed = bool ( isinstance (typ , UnboundType ) and ( typ . args or typ . empty_tuple_index ))
4041+ return analyzed , new_tvar_defs , depends_on , indexed
40424042
40434043 def is_pep_613 (self , s : AssignmentStmt ) -> bool :
40444044 if s .unanalyzed_type is not None and isinstance (s .unanalyzed_type , UnboundType ):
@@ -4137,10 +4137,10 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
41374137 res = NoneType ()
41384138 alias_tvars : list [TypeVarLikeType ] = []
41394139 depends_on : set [str ] = set ()
4140- empty_tuple_index = False
4140+ indexed = False
41414141 else :
41424142 tag = self .track_incomplete_refs ()
4143- res , alias_tvars , depends_on , empty_tuple_index = self .analyze_alias (
4143+ res , alias_tvars , depends_on , indexed = self .analyze_alias (
41444144 lvalue .name ,
41454145 rvalue ,
41464146 allow_placeholder = True ,
@@ -4180,12 +4180,11 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
41804180 no_args = (
41814181 isinstance (res , ProperType )
41824182 and isinstance (res , Instance )
4183- and not res .args
4184- and not empty_tuple_index
41854183 and not pep_695
4184+ and not indexed
41864185 )
41874186 if isinstance (res , ProperType ) and isinstance (res , Instance ):
4188- if not validate_instance (res , self .fail , empty_tuple_index ):
4187+ if not validate_instance (res , self .fail , indexed ):
41894188 fix_instance (res , self .fail , self .note , disallow_any = False , options = self .options )
41904189 # Aliases defined within functions can't be accessed outside
41914190 # the function, since the symbol table will no longer
@@ -5689,7 +5688,7 @@ def visit_type_alias_stmt(self, s: TypeAliasStmt) -> None:
56895688 return
56905689
56915690 tag = self .track_incomplete_refs ()
5692- res , alias_tvars , depends_on , empty_tuple_index = self .analyze_alias (
5691+ res , alias_tvars , depends_on , indexed = self .analyze_alias (
56935692 s .name .name ,
56945693 s .value .expr (),
56955694 allow_placeholder = True ,
0 commit comments