-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Defer integer literal type resolution until after type checking #711
Defer integer literal type resolution until after type checking #711
Conversation
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
You mean |
Oups - yes with 256 we should really get an error. 255 is okay. I updated the description, thanks. |
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
Signed-off-by: Mohammad Fawaz <mohammadfawaz89@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved w/ nit -- up to you whether or not to address it.
test/src/e2e_vm_tests/test_programs/literal_too_large_for_type/Forc.toml
Outdated
Show resolved
Hide resolved
…/Forc.toml Co-authored-by: Alex Hansen <alex@alex-hansen.com>
Fixes #653
This patch basically tries to remove the assumption that integer literals are 64 bit wide. This implies the following:
let x:u32 = 5;
does not generate a warning.let x:u8 = 256;
generates an error because256
does not fit in au8
.I was hoping to completely remove implicit casting between
UnsignedInteger
s inengine.rs
, but there are more complex situations for which resolving the type of literals without the 64-bit assumption is not yet possible. E.g.:Ideally, we would recognize
256
has to be au8
and error out, but that requires more complex analysis than what I have in this change.