Skip to content
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

Squelch quotes with -error-style short #3146

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ocaml/testsuite/tests/misc/short_errors.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(* TEST
flags = "-error-style short";
expect;
*)

let _ = 1 + true

[%%expect{|
Line 1, characters 12-16:
Error: This expression has type bool but an expression was expected of type
int
|}]
13 changes: 12 additions & 1 deletion ocaml/utils/clflags.ml
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,18 @@ let error_style = ref None (* -error-style *)
let error_style_reader = {
parse = (function
| "contextual" -> Some Misc.Error_style.Contextual
| "short" -> Some Misc.Error_style.Short
| "short" ->
(* Jane Street specific: This little bit of code suppresses the quote
marks in error messages. Remove this after we can get formatted
output in our editors. *)
let styles = Misc.Style.get_styles () in
let styles =
{ styles with inline_code =
{ styles.inline_code with text_open = ""; text_close = "" } }
in
Misc.Style.set_styles styles;
(* End Jane Street specific code *)
Some Misc.Error_style.Short
| _ -> None);
print = (function
| Misc.Error_style.Contextual -> "contextual"
Expand Down
Loading