tuple fix
This commit is contained in:
parent
dd02c795c7
commit
53e82f5603
@ -216,7 +216,7 @@ def parse_binding(name, ty):
|
||||
raise CustomError(f'pattern matching length mismatch')
|
||||
result = {}
|
||||
for x, y in zip(name.elts, ty.params):
|
||||
result |= parse_name(x, y)
|
||||
result |= parse_binding(x, y)
|
||||
return result
|
||||
else:
|
||||
raise CustomError(f'binding to {name} is not supported')
|
||||
|
@ -82,6 +82,10 @@ test_expr('a if a == b else b', {'a': I, 'b': I})
|
||||
test_expr('[x for x in [1, 2, 3]]', {})
|
||||
test_expr('[1 for x in [1, 2, 3] if x > 2]', {})
|
||||
test_expr('[a + a for x in [1, 2, 3] if x > 2]', {'a': I})
|
||||
test_expr('[a for a, b in [(1, 2), (2, 3), (3, 4)] if b > 2]', {})
|
||||
test_expr('[b for a, b in [(1, (2, 3)), (2, (3, 4)), (3, (4, 5))] if b > 2]', {})
|
||||
test_expr('[b for a, b in [(1, (2, 3)), (2, (3, 4)), (3, (4, 5))]]', {})
|
||||
test_expr('[b for a, (b, c) in [(1, (2, 3)), (2, (3, 4)), (3, (4, 5))] if b > 2]', {})
|
||||
|
||||
test_classes = """
|
||||
class Foo:
|
||||
|
Loading…
Reference in New Issue
Block a user