Skip to content

Commit 2d177e9

Browse files
Update constant_fold.py
1 parent 70fa984 commit 2d177e9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mypyc/irbuild/constant_fold.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from mypy.constant_fold import constant_fold_binary_op, constant_fold_unary_op
1616
from mypy.nodes import (
1717
BytesExpr,
18+
CastExpr,
1819
ComplexExpr,
1920
Expression,
2021
FloatExpr,
@@ -72,6 +73,8 @@ def constant_fold_expr(builder: IRBuilder, expr: Expression) -> ConstantValue |
7273
value = constant_fold_expr(builder, expr.expr)
7374
if value is not None and not isinstance(value, bytes):
7475
return constant_fold_unary_op(expr.op, value)
76+
elif isinstance(expr, CastExpr):
77+
return constant_fold_expr(builder, expr.expr)
7578
return None
7679

7780

0 commit comments

Comments
 (0)