-
Notifications
You must be signed in to change notification settings - Fork 327
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
Fixing small bugs uncovered by type checker #11422
Conversation
Runtime.assert (decimal_places <= 0) | ||
## We assert that the decimal_places is non-positive, so the scale will be an Integer. | ||
We can tell that to the type-checker by adding an annotation. | ||
scale = (10 ^ -decimal_places) : Integer |
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.
This assert is documenting that this method will not work if decimal_places > 0
. That is because then scale
would be a Float
which has no div
method, so it would fail at runtime with No_Such_Method
error. That's what the checker uncovered.
All tests were passing so it's either never called with decimal_places > 0
or our tests don't cover all the cases.
@GregoryTravis do you know if this method is ever expected to be called with decimal_places > 0
? It was unclear to me looking at DB_Column.round
and should_use_builtin_round
if that is the case or not.
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.
Yes, I must be missing some test case. Added #11424.
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.
Thank you
a15d803
to
c81d863
Compare
…lly work with `decimal_places > 0`. See if that's enough.
c81d863
to
68c05fc
Compare
Pull Request Description
Once our libraries and tests are compiled with basic inference of method types, some warnings were reported:
This PR attempts to fix them.
There was also an expected error in the Examples:
To avoid getting a warning, I wrapped this in
(_ : Any)
to make the warning go away. The behaviour of the function is unchanged.Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.