Skip to content

Commit 7605686

Browse files
Update constant_fold.py
1 parent 80b6b58 commit 7605686

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mypyc/irbuild/constant_fold.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from __future__ import annotations
1212

13-
from typing import Final, Union
13+
from typing import TYPE_CHECKING, Final, Union
1414

1515
from mypy.constant_fold import constant_fold_binary_op, constant_fold_unary_op
1616
from mypy.nodes import (
@@ -26,15 +26,16 @@
2626
UnaryExpr,
2727
Var,
2828
)
29-
from mypyc.irbuild.builder import IRBuilder
3029
from mypyc.irbuild.util import bytes_from_str
30+
if TYPE_CHECKING:
31+
from mypyc.irbuild.builder import IRBuilder
3132

3233
# All possible result types of constant folding
3334
ConstantValue = Union[int, float, complex, str, bytes]
3435
CONST_TYPES: Final = (int, float, complex, str, bytes)
3536

3637

37-
def constant_fold_expr(builder: IRBuilder, expr: Expression) -> ConstantValue | None:
38+
def constant_fold_expr(builder: "IRBuilder", expr: Expression) -> ConstantValue | None:
3839
"""Return the constant value of an expression for supported operations.
3940
4041
Return None otherwise.

0 commit comments

Comments
 (0)