Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3022,6 +3022,7 @@ def process_type_annotation(self, s: AssignmentStmt) -> None:
analyzed = self.anal_type(s.type, allow_tuple_literal=allow_tuple_literal)
# Don't store not ready types (including placeholders).
if analyzed is None or has_placeholder(analyzed):
self.defer(s)
return
s.type = analyzed
if (
Expand Down
20 changes: 20 additions & 0 deletions test-data/unit/check-dataclasses.test
Original file line number Diff line number Diff line change
Expand Up @@ -1913,3 +1913,23 @@ class MyDataclass:

takes_cp(MyDataclass)
[builtins fixtures/dataclasses.pyi]

[case testDataclassTypeAnnotationAliasUpdated]
# flags: --enable-recursive-aliases
import a
[file a.py]
from dataclasses import dataclass
from b import B

@dataclass
class D:
x: B

reveal_type(D) # N: Revealed type is "def (x: builtins.list[b.C]) -> a.D"
[file b.py]
from typing import List
import a
B = List[C]
class C(CC): ...
class CC: ...
[builtins fixtures/dataclasses.pyi]