-
-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type of integer constant is ignored during folding of literal ops #2830
Comments
This also compiles, when it should not:
|
This also compiles, when it should not:
[UPDATE - this now throws an |
Another example:
|
Might be redundant with your examples, but I got this one which is compiling: a:constant(uint256)=1
b:constant(uint16)=a+0 Where this one does not: a:constant(uint256)=1
b:constant(uint16)=a |
Cool! I will add both examples as test cases to #3201. |
As a side note, this also causes some funky stuff when used as array index: CONST: constant(int128) = 1
@external
def foo():
array: uint256[10] = empty(uint256[10])
a: int128 = 1
array[a + CONST] = 20 When compiled this results in an AssertionError that is supposed to be unreachable. |
Interesting, for this one it seems that the typechecker allows |
i think this was solved during recent refactoring of constant folding (see #3669 and #3719). @ToonVanHove @trocher please reopen if there are still any issues. |
Version Information
vyper --version
): 0.3.3python --version
): 3.8.5What's your issue about?
Please include information like:
This contract compiles when it should throw a typechecking error.
How can it be fixed?
Annotate the folded nodes with the original type information.
The text was updated successfully, but these errors were encountered: