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
Could the error message when passing an empty char be better? #10196
Labels
Comments
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 4, 2021
Before this would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 4, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: The empty character literal '' is invalid. We expect a character > between single quotes (possibly a space ' ') or a single quote for > type variables 'a. Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
Thanks for the report. I propose a fix in #10197. |
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 4, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal; did you mean ' ' or a type variable 'a ? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 4, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 4, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 4, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 5, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean a space character literal ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 5, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' (a space character literal) or 'a (a type variable)? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
gasche
added a commit
to gasche/ocaml
that referenced
this issue
Feb 5, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
The fix was merged, with the following error message:
|
Thank you! |
garrigue
pushed a commit
to garrigue/ocaml
that referenced
this issue
Mar 3, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
smuenzel
pushed a commit
to smuenzel/ocaml
that referenced
this issue
Mar 30, 2021
Before: > # '';; > Error: Syntax error After: > # '';; > Error: Illegal empty character literal '' > Hint: Did you mean ' ' or a type variable 'a? Before, this input would get correctly lexed into QUOTE QUOTE and then fail in the parser with a generic "Syntax error" message. (Even if we had better error messages in the parser, here the parser-level error would not be very illuminating as ' is never the start of a valid expression or structure item). Fixes ocaml#10196.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tripped myself with this and my eyes didn't spot the missing space between the the single quotes. Unfortunately the compiler was only moderately helpful too. Could this error message be clarified?
The text was updated successfully, but these errors were encountered: