Skip to content

Commit add67ea

Browse files
Update constant_fold.py
1 parent be6a048 commit add67ea

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

mypyc/irbuild/constant_fold.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ def constant_fold_expr(builder: IRBuilder, expr: Expression) -> ConstantValue |
9393
return folded_callee.join(folded_items) # type: ignore [arg-type]
9494
if expr_type := builder.types.get(arg):
9595
proper_type = get_proper_type(expr_type)
96-
if isinstance(proper_type, TupleType) and all(
97-
isinstance(i, LiteralType) and isinstance(i.value, str)
98-
for i in proper_type.items
99-
):
100-
return folded_callee.join(i.value for i in proper_type.items) # type: ignore [attr-defined]
96+
if isinstance(proper_type, TupleType):
97+
types = list(map(get_proper_type, proper_type.items))
98+
if all(isinstance(i, LiteralType) and isinstance(i.value, str) for i in types):
99+
return folded_callee.join(i.value for i in types) # type: ignore [attr-defined]
101100

102101
# builtins.bytes methods
103102
elif isinstance(folded_callee, bytes):

0 commit comments

Comments
 (0)