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
Add a hint suggesting to use ( * ) when (*) is used #1534
Conversation
utils/warnings.ml
Outdated
@@ -304,7 +304,8 @@ let () = parse_options false defaults_w;; | |||
let () = parse_options true defaults_warn_error;; | |||
|
|||
let message = function | |||
| Comment_start -> "this is the start of a comment." | |||
| Comment_start -> "this is the start of a comment.\n\ | |||
Hint: Did you mean `( * )'?" |
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.
Would it not be a bit clearer to precise that ( * )
is an operator: Did you mean the 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.
Good point!
4c0c8f2
to
b552215
Compare
Why not be fully explicit, "the infix operator ( * ) for multiplication"? |
b552215
to
01b3d6c
Compare
Indeed. Patch updated. |
Some weak counter-arguments
But I agree that |
I apologize for the bike-shedding, but I think that " |
Maybe Also, going beyond one line of hint in
feels a bit verbose. |
Yep, "This For the second sentence, my idea was to say explicitly "you need to add spaces", but if there is no space (sic) for this maybe just showing the symbol without a space above and the symbol with spaces below is enough. |
Then maybe we should put the focus on the actual human mistake: |
Excellent! |
01b3d6c
to
37b413e
Compare
Thanks for the discussion. I just amended the patch. |
(Why are you using double-backtick in the first line, and backtick-singlequote in the second line?) |
37b413e
to
1636b6a
Compare
(Oops, fixed) |
Just a remark for next time: backtick and single quote are not a pair of matched quotation marks, so you shouln't use them in this way. The problem is rather well explained in this page: http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html |
A common rookie mistake is to write
(*)
, trying to get the prefix equivalent of the multiplication function -- the compiler rightfully warns that this is in fact the beginning of a comment, but does not explain how to actually get the prefix version.This patch simply extends the existing warning in order to suggest using
( * )
instead.