Skip to content

Commit

Permalink
refactor: remove TodoErrors of supporting upcast from bool to numeric…
Browse files Browse the repository at this point in the history
… types, logged as issue #193 instead
  • Loading branch information
achidlow committed Apr 12, 2024
1 parent 28150d0 commit 39954b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/puya/awst_build/eb/arc4/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)
from puya.awst_build.eb.base import BuilderComparisonOp, ExpressionBuilder
from puya.awst_build.eb.var_factory import var_expression
from puya.errors import CodeError, InternalError, TodoError
from puya.errors import CodeError, InternalError

if typing.TYPE_CHECKING:
from collections.abc import Sequence
Expand Down Expand Up @@ -207,8 +207,6 @@ def compare(
)
case wtypes.uint64_wtype:
other_expr = uint64_to_biguint(other, location)
case wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to arc4.UIntN")
case _:
return NotImplemented
cmp_expr = NumericComparisonExpression(
Expand Down
8 changes: 1 addition & 7 deletions src/puya/awst_build/eb/biguint.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from puya.awst_build.eb.bytes_backed import BytesBackedClassExpressionBuilder
from puya.awst_build.eb.var_factory import var_expression
from puya.awst_build.utils import convert_literal_to_expr
from puya.errors import CodeError, TodoError
from puya.errors import CodeError

if typing.TYPE_CHECKING:
from collections.abc import Sequence
Expand Down Expand Up @@ -102,8 +102,6 @@ def compare(
pass
elif other_expr.wtype == wtypes.uint64_wtype:
other_expr = uint64_to_biguint(other, location)
elif other_expr.wtype == wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to biguint")
else:
return NotImplemented
cmp_expr = NumericComparisonExpression(
Expand All @@ -127,8 +125,6 @@ def binary_op(
pass
elif other_expr.wtype == wtypes.uint64_wtype:
other_expr = uint64_to_biguint(other, location)
elif other_expr.wtype == wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to biguint")
else:
return NotImplemented
lhs = self.expr
Expand All @@ -149,8 +145,6 @@ def augmented_assignment(
pass
elif value.wtype == wtypes.uint64_wtype:
value = uint64_to_biguint(rhs, location)
elif value.wtype == wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to biguint")
else:
raise CodeError(
f"Invalid operand type {value.wtype} for {op.value}= with {self.wtype}", location
Expand Down
8 changes: 1 addition & 7 deletions src/puya/awst_build/eb/uint64.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
)
from puya.awst_build.eb.var_factory import var_expression
from puya.awst_build.utils import convert_literal_to_expr
from puya.errors import CodeError, TodoError
from puya.errors import CodeError

if typing.TYPE_CHECKING:
from collections.abc import Sequence
Expand Down Expand Up @@ -101,8 +101,6 @@ def compare(
other_expr = convert_literal_to_expr(other, self.wtype)
if other_expr.wtype == self.wtype:
pass
elif other_expr.wtype == wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to uint64")
else:
return NotImplemented
cmp_expr = NumericComparisonExpression(
Expand All @@ -124,8 +122,6 @@ def binary_op(
other_expr = convert_literal_to_expr(other, self.wtype)
if other_expr.wtype == self.wtype:
pass
elif other_expr.wtype == wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to uint64")
else:
return NotImplemented
lhs = self.expr
Expand All @@ -144,8 +140,6 @@ def augmented_assignment(
value = convert_literal_to_expr(rhs, self.wtype)
if value.wtype == self.wtype:
pass
elif value.wtype == wtypes.bool_wtype:
raise TodoError(location, "TODO: support upcast from bool to uint64")
else:
raise CodeError(
f"Invalid operand type {value.wtype} for {op.value}= with {self.wtype}", location
Expand Down

0 comments on commit 39954b0

Please sign in to comment.