@@ -3958,8 +3958,10 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
39583958 # so we need to replace it with non-explicit Anys.
39593959 res = make_any_non_explicit (res )
39603960 if self .options .disallow_any_unimported and has_any_from_unimported_type (res ):
3961- self .msg .unimported_type_becomes_any ("Type alias target" , res , s )
3962- res = make_any_non_unimported (res )
3961+ # Only show error message once, when the type is fully analyzed.
3962+ if not has_placeholder (res ):
3963+ self .msg .unimported_type_becomes_any ("Type alias target" , res , s )
3964+ res = make_any_non_unimported (res )
39633965 # Note: with the new (lazy) type alias representation we only need to set no_args to True
39643966 # if the expected number of arguments is non-zero, so that aliases like `A = List` work
39653967 # but not aliases like `A = TypeAliasType("A", List)` as these need explicit type params.
@@ -4013,6 +4015,8 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
40134015 existing .node .alias_tvars = alias_tvars
40144016 existing .node .no_args = no_args
40154017 updated = True
4018+ # Invalidate recursive status cache in case it was previously set.
4019+ existing .node ._is_recursive = None
40164020 else :
40174021 # Otherwise just replace existing placeholder with type alias.
40184022 existing .node = alias_node
0 commit comments