From 39954b0aa85cf79da54fd10f6336a33107f3b87f Mon Sep 17 00:00:00 2001 From: Adam Chidlow Date: Fri, 12 Apr 2024 14:29:28 +0800 Subject: [PATCH] refactor: remove TodoErrors of supporting upcast from bool to numeric types, logged as issue #193 instead --- src/puya/awst_build/eb/arc4/numeric.py | 4 +--- src/puya/awst_build/eb/biguint.py | 8 +------- src/puya/awst_build/eb/uint64.py | 8 +------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/puya/awst_build/eb/arc4/numeric.py b/src/puya/awst_build/eb/arc4/numeric.py index aefc8c0a11..3ba052f4f4 100644 --- a/src/puya/awst_build/eb/arc4/numeric.py +++ b/src/puya/awst_build/eb/arc4/numeric.py @@ -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 @@ -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( diff --git a/src/puya/awst_build/eb/biguint.py b/src/puya/awst_build/eb/biguint.py index 6d194c2c1d..25dd40717e 100644 --- a/src/puya/awst_build/eb/biguint.py +++ b/src/puya/awst_build/eb/biguint.py @@ -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 @@ -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( @@ -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 @@ -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 diff --git a/src/puya/awst_build/eb/uint64.py b/src/puya/awst_build/eb/uint64.py index 264eb5e989..7e1bc651b4 100644 --- a/src/puya/awst_build/eb/uint64.py +++ b/src/puya/awst_build/eb/uint64.py @@ -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 @@ -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( @@ -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 @@ -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