Skip to content

Commit 0a14359

Browse files
Update constant_fold.py
1 parent 286a108 commit 0a14359

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mypyc/irbuild/constant_fold.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ def try_constant_fold(builder: IRBuilder, expr: Expression) -> Value | None:
146146

147147

148148
def folding_candidate(
149-
transform: Callable[[IRBuilder, Expression], Value | None],
150-
) -> Callable[[IRBuilder, Expression], Value | None]:
149+
transform: Callable[[IRBuilder, Expression], Value],
150+
) -> Callable[[IRBuilder, Expression], Value]:
151151
"""Mark a transform function as a candidate for constant folding.
152152
153153
Candidate functions will attempt to short-circuit the transformation
154154
by constant folding the expression and will only proceed to transform
155155
the expression if folding is not possible.
156156
"""
157157

158-
def constant_fold_wrap(builder: IRBuilder, expr: Expression) -> Value | None:
158+
def constant_fold_wrap(builder: IRBuilder, expr: Expression) -> Value:
159159
folded = try_constant_fold(builder, expr)
160160
return folded if folded is not None else transform(builder, expr)
161161

0 commit comments

Comments
 (0)