@@ -112,9 +112,9 @@ def visit_unbound_type(self, t: UnboundType) -> Type:
112112 return self .builtin_type ('builtins.tuple' )
113113 if len (t .args ) == 2 and isinstance (t .args [1 ], EllipsisType ):
114114 # Tuple[T, ...] (uniform, variable-length tuple)
115- node = self .lookup_fqn_func ('builtins.tuple' )
116- tuple_info = cast ( TypeInfo , node . node )
117- return Instance ( tuple_info , [ t . args [ 0 ]. accept ( self )], t . line )
115+ instance = self .builtin_type ('builtins.tuple' , [ t . args [ 0 ]. accept ( self )] )
116+ instance . line = t . line
117+ return instance
118118 return self .tuple_type (self .anal_array (t .args ))
119119 elif fullname == 'typing.Union' :
120120 items = self .anal_array (t .args )
@@ -291,8 +291,8 @@ def anal_var_defs(self, var_defs: List[TypeVarDef]) -> List[TypeVarDef]:
291291
292292 def builtin_type (self , fully_qualified_name : str , args : List [Type ] = None ) -> Instance :
293293 node = self .lookup_fqn_func (fully_qualified_name )
294- info = cast ( TypeInfo , node .node )
295- return Instance (info , args or [])
294+ assert isinstance ( node .node , TypeInfo )
295+ return Instance (node . node , args or [])
296296
297297 def tuple_type (self , items : List [Type ]) -> TupleType :
298298 return TupleType (items , fallback = self .builtin_type ('builtins.tuple' , [AnyType ()]))
0 commit comments