-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Hint on type error on int literal #2301
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
Conversation
Nice! What about |
|
Do I understand correctly that if I typed |
Yes. Because |
I think it would better if the hints were symmetric. |
I implemented symmetry, except in two cases: to |
I agree that for the |
@Octachron: yes, but think about |
I had the simpler |
In other words, we are expecting the uncommon literal to be more likely to carry genuine intent compared to the context in this case. This sounds like a reasonable heuristic. It could be nice to document this design choice in a comment (along with the |
typing/ctype.mli
Outdated
@@ -70,6 +70,11 @@ module Unification_trace: sig | |||
(** Switch [expected] and [got] *) | |||
val swap: t -> t | |||
|
|||
(** [explain f trace] calls [f] on trace elements starting from the end |
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.
[explain f trace]
→ [explain trace f]
For the record, in that case @Julow, @Armael and myself discussed extending the "type forcing context" to remember "under a binary operator |
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.
The current state is fine. Please fix the small issue noticed by @Octachron ( [explain f trace] → [explain trace f]
) and add a Changes entry, and this should be good to merge.
Done. |
261ea2a
to
2ceeaf5
Compare
I've rewritten the history. |
@Julow:
|
It's fixed. |
2ceeaf5
to
241f90a
Compare
Add an hint on type error on int literal where expecting int32, int64 or nativeint.
Example:
Will give: