@@ -1112,7 +1112,6 @@ def visit_callable_type(
11121112 return ret
11131113
11141114 def anal_type_guard (self , t : Type ) -> Type | None :
1115- t = t .resolve_string_annotation ()
11161115 if isinstance (t , UnboundType ):
11171116 sym = self .lookup_qualified (t .name , t )
11181117 if sym is not None and sym .node is not None :
@@ -1131,7 +1130,6 @@ def anal_type_guard_arg(self, t: UnboundType, fullname: str) -> Type | None:
11311130 return None
11321131
11331132 def anal_type_is (self , t : Type ) -> Type | None :
1134- t = t .resolve_string_annotation ()
11351133 if isinstance (t , UnboundType ):
11361134 sym = self .lookup_qualified (t .name , t )
11371135 if sym is not None and sym .node is not None :
@@ -1149,7 +1147,6 @@ def anal_type_is_arg(self, t: UnboundType, fullname: str) -> Type | None:
11491147
11501148 def anal_star_arg_type (self , t : Type , kind : ArgKind , nested : bool ) -> Type :
11511149 """Analyze signature argument type for *args and **kwargs argument."""
1152- t = t .resolve_string_annotation ()
11531150 if isinstance (t , UnboundType ) and t .name and "." in t .name and not t .args :
11541151 components = t .name .split ("." )
11551152 tvar_name = "." .join (components [:- 1 ])
@@ -1275,8 +1272,6 @@ def visit_raw_expression_type(self, t: RawExpressionType) -> Type:
12751272 # make signatures like "foo(x: 20) -> None" legal, we can change
12761273 # this method so it generates and returns an actual LiteralType
12771274 # instead.
1278- if t .node is not None :
1279- return t .node .accept (self )
12801275
12811276 if self .report_invalid_types :
12821277 if t .base_type_name in ("builtins.int" , "builtins.bool" ):
@@ -1539,7 +1534,6 @@ def analyze_callable_args(
15391534 invalid_unpacks : list [Type ] = []
15401535 second_unpack_last = False
15411536 for i , arg in enumerate (arglist .items ):
1542- arg = arg .resolve_string_annotation ()
15431537 if isinstance (arg , CallableArgument ):
15441538 args .append (arg .typ )
15451539 names .append (arg .name )
@@ -1620,6 +1614,18 @@ def analyze_literal_type(self, t: UnboundType) -> Type:
16201614 return UnionType .make_union (output , line = t .line )
16211615
16221616 def analyze_literal_param (self , idx : int , arg : Type , ctx : Context ) -> list [Type ] | None :
1617+ # This UnboundType was originally defined as a string.
1618+ if isinstance (arg , UnboundType ) and arg .original_str_expr is not None :
1619+ assert arg .original_str_fallback is not None
1620+ return [
1621+ LiteralType (
1622+ value = arg .original_str_expr ,
1623+ fallback = self .named_type (arg .original_str_fallback ),
1624+ line = arg .line ,
1625+ column = arg .column ,
1626+ )
1627+ ]
1628+
16231629 # If arg is an UnboundType that was *not* originally defined as
16241630 # a string, try expanding it in case it's a type alias or something.
16251631 if isinstance (arg , UnboundType ):
@@ -2605,8 +2611,7 @@ def visit_typeddict_type(self, t: TypedDictType) -> None:
26052611 self .process_types (list (t .items .values ()))
26062612
26072613 def visit_raw_expression_type (self , t : RawExpressionType ) -> None :
2608- if t .node is not None :
2609- t .node .accept (self )
2614+ pass
26102615
26112616 def visit_literal_type (self , t : LiteralType ) -> None :
26122617 pass
0 commit comments