@@ -483,15 +483,15 @@ def visit_unbound_type_nonoptional(self, t: UnboundType, defining_literal: bool)
483483 self .options ,
484484 unexpanded_type = t ,
485485 disallow_any = disallow_any ,
486- empty_tuple_index = t .empty_tuple_index ,
486+ has_parameters = t .has_parameters ,
487487 )
488488 # The only case where instantiate_type_alias() can return an incorrect instance is
489489 # when it is top-level instance, so no need to recurse.
490490 if (
491491 isinstance (res , ProperType )
492492 and isinstance (res , Instance )
493493 and not (self .defining_alias and self .nesting_level == 0 )
494- and not validate_instance (res , self .fail , t .empty_tuple_index )
494+ and not validate_instance (res , self .fail , t .has_parameters )
495495 ):
496496 fix_instance (
497497 res ,
@@ -506,7 +506,7 @@ def visit_unbound_type_nonoptional(self, t: UnboundType, defining_literal: bool)
506506 res = get_proper_type (res )
507507 return res
508508 elif isinstance (node , TypeInfo ):
509- return self .analyze_type_with_type_info (node , t .args , t , t .empty_tuple_index )
509+ return self .analyze_type_with_type_info (node , t .args , t , t .has_parameters )
510510 elif node .fullname in TYPE_ALIAS_NAMES :
511511 return AnyType (TypeOfAny .special_form )
512512 # Concatenate is an operator, no need for a proper type
@@ -629,7 +629,7 @@ def try_analyze_special_unbound_type(self, t: UnboundType, fullname: str) -> Typ
629629 else :
630630 self .fail ('Name "tuple" is not defined' , t )
631631 return AnyType (TypeOfAny .special_form )
632- if len (t .args ) == 0 and not t .empty_tuple_index :
632+ if len (t .args ) == 0 and not t .has_parameters :
633633 # Bare 'Tuple' is same as 'tuple'
634634 any_type = self .get_omitted_any (t )
635635 return self .named_type ("builtins.tuple" , [any_type ], line = t .line , column = t .column )
@@ -815,7 +815,7 @@ def check_and_warn_deprecated(self, info: TypeInfo, ctx: Context) -> None:
815815 warn (deprecated , ctx , code = codes .DEPRECATED )
816816
817817 def analyze_type_with_type_info (
818- self , info : TypeInfo , args : Sequence [Type ], ctx : Context , empty_tuple_index : bool
818+ self , info : TypeInfo , args : Sequence [Type ], ctx : Context , has_parameters : bool
819819 ) -> Type :
820820 """Bind unbound type when were able to find target TypeInfo.
821821
@@ -853,7 +853,7 @@ def analyze_type_with_type_info(
853853 # Check type argument count.
854854 instance .args = tuple (flatten_nested_tuples (instance .args ))
855855 if not (self .defining_alias and self .nesting_level == 0 ) and not validate_instance (
856- instance , self .fail , empty_tuple_index
856+ instance , self .fail , has_parameters
857857 ):
858858 fix_instance (
859859 instance ,
@@ -2121,7 +2121,7 @@ def instantiate_type_alias(
21212121 unexpanded_type : Type | None = None ,
21222122 disallow_any : bool = False ,
21232123 use_standard_error : bool = False ,
2124- empty_tuple_index : bool = False ,
2124+ has_parameters : bool = False ,
21252125) -> Type :
21262126 """Create an instance of a (generic) type alias from alias node and type arguments.
21272127
@@ -2149,7 +2149,7 @@ def instantiate_type_alias(
21492149 if (
21502150 max_tv_count > 0
21512151 and act_len == 0
2152- and not (empty_tuple_index and node .tvar_tuple_index is not None )
2152+ and not (has_parameters and node .tvar_tuple_index is not None )
21532153 ):
21542154 # Interpret bare Alias same as normal generic, i.e., Alias[Any, Any, ...]
21552155 return set_any_tvars (
@@ -2466,7 +2466,7 @@ def make_optional_type(t: Type) -> Type:
24662466 return UnionType ([t , NoneType ()], t .line , t .column )
24672467
24682468
2469- def validate_instance (t : Instance , fail : MsgCallback , empty_tuple_index : bool ) -> bool :
2469+ def validate_instance (t : Instance , fail : MsgCallback , has_parameters : bool ) -> bool :
24702470 """Check if this is a well-formed instance with respect to argument count/positions."""
24712471 # TODO: combine logic with instantiate_type_alias().
24722472 if any (unknown_unpack (a ) for a in t .args ):
@@ -2485,9 +2485,9 @@ def validate_instance(t: Instance, fail: MsgCallback, empty_tuple_index: bool) -
24852485 ):
24862486 correct = True
24872487 if not t .args :
2488- if not (empty_tuple_index and len (t .type .type_vars ) == 1 ):
2488+ if not (has_parameters and len (t .type .type_vars ) == 1 ):
24892489 # The Any arguments should be set by the caller.
2490- if empty_tuple_index and min_tv_count :
2490+ if has_parameters and min_tv_count :
24912491 fail (
24922492 f"At least { min_tv_count } type argument(s) expected, none given" ,
24932493 t ,
0 commit comments