We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fbf4de commit e63501cCopy full SHA for e63501c
test-data/unit/check-dataclasses.test
@@ -495,6 +495,19 @@ reveal_type(A.foo("foo")) # N: Revealed type is "builtins.str"
495
496
[builtins fixtures/dataclasses.pyi]
497
498
+[case testClassmethodShadowingFieldDoesNotCrash]
499
+# flags: --python-version 3.7
500
+from dataclasses import dataclass
501
+
502
+# This used to crash -- see #6217
503
+@dataclass
504
+class Foo:
505
+ bar: str
506
+ @classmethod # E: Name "bar" already defined on line 7
507
+ def bar(cls) -> "Foo":
508
+ return cls('asdf')
509
+[builtins fixtures/dataclasses.pyi]
510
511
[case testDataclassesClassVars]
512
# flags: --python-version 3.7
513
from dataclasses import dataclass
0 commit comments