You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5271 Reporter: rrolles Assigned to:@damiendoligez Status: closed (set by @xavierleroy on 2016-12-07T10:47:16Z) Resolution: fixed Priority: normal Severity: minor Version: 3.12.0 Target version: 4.02.2+dev / +rc1 Fixed in version: 4.02.2+dev / +rc1 Category: ~DO NOT USE (was: OCaml general)
Bug description
I have embedded a REPL in a third-party application. Things that issue errors are properly printed as errors, i.e.:
Characters 28-31:
let f = function | 1 -> 0 | "x" -> 1;;
Error: This pattern matches values of type string but a pattern was expected which matches values of type int
However, things that issue warnings instead give general errors about bad I/O descriptors:
Characters -1--1:
let f = function | 1 -> 0 | 1 -> 1;;
Error: I/O error: Bad file descriptor
I tracked down the cause of this behavior to parsing/location.ml, in the function prerr_warning:
open Format
let prerr_warning loc w = print_warning loc err_formatter w;;
For my purposes, I was able to change err_formatter to std_formatter, and I obtain the proper compiler warnings in my toplevel. In general, it would be nice if the source was changed upstream somehow such that such warnings were redirected into the functions I had registered using Format.set_formatter_output_functions.
The text was updated successfully, but these errors were encountered:
I know this bug does not seem very sexy or important given its modest description. However, it not being fixed means that users of my program IDAOCaml (an OCaml REPL for a third-party application) have to modify OCaml and recompile it from scratch. If it was fixed, they could just use the binary distribution. Pretty please?
Original bug ID: 5271
Reporter: rrolles
Assigned to: @damiendoligez
Status: closed (set by @xavierleroy on 2016-12-07T10:47:16Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.0
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.02.2+dev / +rc1
Category: ~DO NOT USE (was: OCaml general)
Bug description
I have embedded a REPL in a third-party application. Things that issue errors are properly printed as errors, i.e.:
Characters 28-31:
let f = function | 1 -> 0 | "x" -> 1;;
Error: This pattern matches values of type string but a pattern was expected which matches values of type int
However, things that issue warnings instead give general errors about bad I/O descriptors:
Characters -1--1:
let f = function | 1 -> 0 | 1 -> 1;;
Error: I/O error: Bad file descriptor
I tracked down the cause of this behavior to parsing/location.ml, in the function prerr_warning:
open Format
let prerr_warning loc w = print_warning loc err_formatter w;;
For my purposes, I was able to change err_formatter to std_formatter, and I obtain the proper compiler warnings in my toplevel. In general, it would be nice if the source was changed upstream somehow such that such warnings were redirected into the functions I had registered using Format.set_formatter_output_functions.
The text was updated successfully, but these errors were encountered: