Skip to content

Commit

Permalink
[AttributeError@constant_folding.py:137] AttributeError: 'UnknownType…
Browse files Browse the repository at this point in the history
…' object has no attribute 'signed' (#358)

* Create draft PR for #357

* Fix incorrect signed check

* Change syntax in constant_folding.py

---------

Co-authored-by: rihi <[email protected]>
Co-authored-by: rihi <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 0ff5502 commit 4acb7f0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ def _constant_fold_shift(constants: list[Constant], fun: Callable[[int, int], in
raise IncompatibleOperandCount("Expected exactly 2 constants to fold")

left, right = constants
norm_signed = signed and isinstance(left.type, Integer) and left.type.signed

return fun(normalize_int(left.value, left.type.size, left.type.signed and signed), right.value)
return fun(normalize_int(left.value, left.type.size, norm_signed), right.value)


_OPERATION_TO_FOLD_FUNCTION: dict[OperationType, Callable[[list[Constant]], int]] = {
Expand Down

0 comments on commit 4acb7f0

Please sign in to comment.