Skip to content

Commit e23edef

Browse files
committed
Update constant_fold.py
1 parent f427d23 commit e23edef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypyc/irbuild/constant_fold.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def constant_fold_expr(builder: IRBuilder, expr: Expression) -> ConstantValue |
7575
if value is not None and not isinstance(value, bytes):
7676
return constant_fold_unary_op(expr.op, value)
7777
elif isinstance(expr, TupleExpr):
78-
folded = tuple(constant_fold_expr(item) for item in expr.items)
78+
folded = tuple(constant_fold_expr(builder, item_expr) for item_expr in expr.items)
7979
if None not in folded:
8080
return folded
8181
elif isinstance(expr, DictExpr):
8282
# NOTE: the builder can't simply use a dict constant like it can with other constants, since dicts are mutable.
8383
# TODO: make the builder load the dict 'constant' by calling copy on a prebuilt constant template instead of building from scratch each time
84-
folded = {constant_fold_expr(key): constant_fold_expr(value) for key, value in expr.items}
84+
folded = {constant_fold_expr(builder, key_expr): constant_fold_expr(builder, value_expr) for key_expr, value_expr in expr.items}
8585
if (
8686
len(folded) == len(expr.items)
8787
and None not in folded.keys()

0 commit comments

Comments
 (0)