Skip to content

Commit 07b17f3

Browse files
committed
Add test
1 parent 083ffca commit 07b17f3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test-data/unit/check-python313.test

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,26 @@ reveal_type(A1().x) # N: Revealed type is "builtins.int"
290290
reveal_type(A2().x) # N: Revealed type is "builtins.int"
291291
reveal_type(A3().x) # N: Revealed type is "builtins.int"
292292
[builtins fixtures/tuple.pyi]
293+
294+
[case testTypeVarDefaultToAnotherTypeVar]
295+
class A[X, Y = X, Z = Y]:
296+
x: X
297+
y: Y
298+
z: Z
299+
300+
a1: A[int]
301+
reveal_type(a1.x) # N: Revealed type is "builtins.int"
302+
reveal_type(a1.y) # N: Revealed type is "builtins.int"
303+
# TODO: this must reveal `int` as well:
304+
reveal_type(a1.z) # N: Revealed type is "X`1"
305+
306+
a2: A[int, str]
307+
reveal_type(a2.x) # N: Revealed type is "builtins.int"
308+
reveal_type(a2.y) # N: Revealed type is "builtins.str"
309+
reveal_type(a2.z) # N: Revealed type is "builtins.str"
310+
311+
a3: A[int, str, bool]
312+
reveal_type(a3.x) # N: Revealed type is "builtins.int"
313+
reveal_type(a3.y) # N: Revealed type is "builtins.str"
314+
reveal_type(a3.z) # N: Revealed type is "builtins.bool"
315+
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)