Skip to content

Commit 379b8aa

Browse files
committed
Add another test case from #10140
1 parent 51a3f06 commit 379b8aa

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎test-data/unit/check-dataclasses.test‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,3 +1669,19 @@ class Parent(Generic[T]):
16691669
Child1(x=1, key='')
16701670
Child2(y=1, key='')
16711671
[builtins fixtures/dataclasses.pyi]
1672+
1673+
[case testDataclassGenericWithBound]
1674+
# flags: --python-version 3.7
1675+
from dataclasses import dataclass
1676+
from typing import Generic, TypeVar
1677+
1678+
T = TypeVar("T", bound="C")
1679+
1680+
@dataclass
1681+
class C(Generic[T]):
1682+
x: int
1683+
1684+
c: C[C]
1685+
d: C[str] # E: Type argument "str" of "C" must be a subtype of "C[Any]"
1686+
C(x=2)
1687+
[builtins fixtures/dataclasses.pyi]

0 commit comments

Comments
 (0)