@@ -71,15 +71,15 @@ def func4(
71
71
def func5 (val : tuple [int ] | tuple [str , str ] | tuple [int , * tuple [str , ...], int ]):
72
72
if len (val ) == 1 :
73
73
# Type can be narrowed to tuple[int].
74
- assert_type (val , tuple [int ]) # tuple[int]
74
+ assert_type (val , tuple [int ]) # E?: tuple[int]
75
75
76
76
if len (val ) == 2 :
77
77
# Type can be narrowed to tuple[str, str] | tuple[int, int].
78
- assert_type (val , tuple [str , str ] | tuple [int , int ])
78
+ assert_type (val , tuple [str , str ] | tuple [int , int ]) # E?
79
79
80
80
if len (val ) == 3 :
81
81
# Type can be narrowed to tuple[int, str, int].
82
- assert_type (val , tuple [int , str , int ])
82
+ assert_type (val , tuple [int , str , int ]) # E?
83
83
84
84
85
85
# > This property may also be used to safely narrow tuple types within a match
@@ -92,15 +92,15 @@ def func6(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int])
92
92
match val :
93
93
case (x ,):
94
94
# Type can be narrowed to tuple[int].
95
- assert_type (val , tuple [int ]) # tuple[int]
95
+ assert_type (val , tuple [int ]) # E?: tuple[int]
96
96
97
97
case (x , y ):
98
98
# Type can be narrowed to tuple[str, str] | tuple[int, int].
99
- assert_type (val , tuple [str , str ] | tuple [int , int ])
99
+ assert_type (val , tuple [str , str ] | tuple [int , int ]) # E?
100
100
101
101
case (x , y , z ):
102
102
# Type can be narrowed to tuple[int, str, int].
103
- assert_type (val , tuple [int , str , int ])
103
+ assert_type (val , tuple [int , str , int ]) # E?
104
104
105
105
106
106
# > Type checkers may safely use this equivalency rule (tuple expansion)
@@ -112,9 +112,9 @@ def func6(val: tuple[int] | tuple[str, str] | tuple[int, *tuple[str, ...], int])
112
112
def func7 (subj : tuple [int | str , int | str ]):
113
113
match subj :
114
114
case x , str ():
115
- assert_type (subj , tuple [int | str , str ])
115
+ assert_type (subj , tuple [int | str , str ]) # E?
116
116
case y :
117
- assert_type (subj , tuple [int | str , int ])
117
+ assert_type (subj , tuple [int | str , int ]) # E?
118
118
119
119
120
120
# > The tuple class derives from Sequence[T_co] where ``T_co`` is a covariant
0 commit comments