Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005271OCamlOCaml generalpublic2011-05-20 00:402014-05-25 20:20
Reporterrrolles 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version3.12.0 
Target Version4.02.0+devFixed in Version 
Summary0005271: parsing/Location.prerr_warning is hard-coded to use Format.err_formatter
DescriptionI 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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-05-20 00:40 rrolles New Issue
2011-05-20 14:30 doligez Status new => assigned
2011-05-20 14:30 doligez Assigned To => doligez
2012-07-10 15:06 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-20 16:21 doligez Assigned To doligez =>
2012-09-20 16:21 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-06-17 16:00 gasche Target Version 4.01.0+dev => 4.02.0+dev
2013-07-12 18:15 doligez Target Version 4.02.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker