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

parsing/Location.prerr_warning is hard-coded to use Format.err_formatter #5271

Closed
vicuna opened this issue May 19, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented May 19, 2011

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.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 26, 2014

Comment author: rrolles

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?

@vicuna

This comment has been minimized.

Copy link
Author

commented Feb 26, 2015

Comment author: @damiendoligez

I fixed this in branch 4.02 (rev 15867). I think. I'll try to install IDAOCaml to check that the problem is really fixed.

@vicuna vicuna closed this Dec 7, 2016

@vicuna vicuna added this to the 4.02.2 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.