Skip to content

Commit

Permalink
Squelch quotes with -error-style short (#3146)
Browse files Browse the repository at this point in the history
* Squelch quotes with -error-style short

* Something mangles comments and can't deal with quote marks
  • Loading branch information
goldfirere authored Oct 16, 2024
1 parent f937ddd commit 7e298e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
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

0 comments on commit 7e298e0

Please sign in to comment.