Open ritzdorf opened 1 month ago
whe i run this example without optimizations --no-optimize
, the revert doesn't happen
@internal
def foo() -> uint256:
return 42
@external
def bar():
assert 43 == (self.foo() if True else self.foo()), "test"
whe i run this example without optimizations
--no-optimize
, the revert doesn't happen@internal def foo() -> uint256: return 42 @external def bar(): assert 43 == (self.foo() if True else self.foo()), "test"
I'd expect such behaviour as I think the issue is due to the optimizer removing the if
or else
expression with the dead branch eliminator but the symbol check is not being deactivated since arithmetic operations optimizations have should_check_symbols
set (and in those case the if/else
is in an arithmetic op)
Version Information
vyper --version
OR linkable commit hash vyperlang/vyper@commitish):0.4.0rc5+commit.98370f50
Issue description
When a ternary operator is used inside conditions, e.g.
if
orassert
compilation fails.Typically the error looks something like:
PoC
Minimal with
assert
:Minimal with
if
:More extensive:
Credit: @pcaversaccio and @trocher