Skip to content

Commit 82ad890

Browse files
committed
Allow errors for unsound Self definitions on non-final classes
1 parent 1df1565 commit 82ad890

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

conformance/tests/generics_self_advanced.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def method2(self) -> None:
4040
@classmethod
4141
def method3(cls) -> None:
4242
assert_type(cls, type[Self])
43-
assert_type(cls.a, list[Self])
44-
assert_type(cls.a[0], Self)
43+
# Allow type checkers to error here, since Self definitions on
44+
# non-final classes are unsound.
45+
a = cls.a # E?
46+
assert_type(a, list[Self])
47+
assert_type(a[0], Self)
4548
assert_type(cls.method1(), Self)

0 commit comments

Comments
 (0)