Skip to content
Merged
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
14 changes: 14 additions & 0 deletions test-data/unit/check-dataclasses.test
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,20 @@ A(a=func).a()
A(a=func).a = func # E: Property "a" defined in "A" is read-only
[builtins fixtures/dataclasses.pyi]

[case testDataclassInFunctionDoesNotCrash]
# flags: --python-version 3.7
from dataclasses import dataclass

def foo():
@dataclass
class Foo:
foo: int
# This used to crash (see #8703)
# The return type of __call__ here needs to be something undefined
# In order to trigger the crash that existed prior to #12762
def __call__(self) -> asdf: ... # E: Name "asdf" is not defined
[builtins fixtures/dataclasses.pyi]

[case testDataclassesMultipleInheritanceWithNonDataclass]
# flags: --python-version 3.10
from dataclasses import dataclass
Expand Down