vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.83k stars 789 forks source link

Compilation errors due to not folded convert value #3985

Open cyberthirst opened 3 months ago

cyberthirst commented 3 months ago

Version Information

Issue description and/or POC

@external
def foo()->bytes32:
   a: bytes32 = convert(0-1, bytes32)
   return a
@external
def foo()->bool:
   return convert(0-1, bool)

Returns vyper.exceptions.TypeMismatch: Expected uint8 but literal can only be cast as int104 or int96.

@external
def foo()->uint256:
   a: uint256 = convert(0-1, uint256)
   return a

Returns vyper.exceptions.StaticAssertionException: assertion found to fail at compile time. (hint: did you mean 'raise'?) [assert, [sge, -1 <0-1>, 0]]

credits: @Leminkay