Skip to content

Commit 6dcc2c2

Browse files
committed
Add test case
1 parent 638f99b commit 6dcc2c2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

mypyc/test-data/irbuild-tuple.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,36 @@ L5:
209209
L6:
210210
return r3
211211

212+
[case testTupleOperatorInFinalTuple]
213+
from typing import Final
214+
215+
tt: Final = (1, 2)
216+
217+
def f(x: int) -> bool:
218+
return x in tt
219+
[out]
220+
def f(x):
221+
x :: int
222+
r0 :: tuple[int, int]
223+
r1 :: bool
224+
r2, r3 :: object
225+
r4 :: i32
226+
r5 :: bit
227+
r6 :: bool
228+
L0:
229+
r0 = __main__.tt :: static
230+
if is_error(r0) goto L1 else goto L2
231+
L1:
232+
r1 = raise NameError('value for final name "tt" was not set')
233+
unreachable
234+
L2:
235+
r2 = box(int, x)
236+
r3 = box(tuple[int, int], r0)
237+
r4 = PySequence_Contains(r3, r2)
238+
r5 = r4 >= 0 :: signed
239+
r6 = truncate r4: i32 to builtins.bool
240+
return r6
241+
212242
[case testTupleBuiltFromList]
213243
def f(val: int) -> bool:
214244
return val % 2 == 0

0 commit comments

Comments
 (0)