Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005697OCamlOCaml typingpublic2012-07-24 10:082012-07-24 11:45
ReporterDrakken 
Assigned Tofrisch 
PrioritylowSeveritytweakReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.12.1 
Target VersionFixed in Version 
Summary0005697: better location info for type errors and/or warnings in sequences & let expressions
DescriptionThe type checker currently reports the location of the entire body of a for loop when the body is mistyped, even though the mistake can be located more precisely for sequences and let expressions.
The included file fizzbuzz.ml has a for loop whose body contains a double let binding and a four-part sequence.
The mistake is in the last part of the sequence, where the call to print_newline is missing its unit argument. (oops! :)
The location of the current type warning unnecessarily contains all six lines
of the body, including both the let bindings and the entire sequence.

Steps To ReproduceCompile fizzbuzz.ml and examine the location info
in the warning message:

$ ocamlc fizzbuzz.ml
File "fizzbuzz.ml", line 5, characters 2-176:
Warning 5: this function application is partial,
maybe some arguments are missing.
Additional InformationPatch is in included file typecore.ml.diff.

Improved output refers to only the faulty subexpression:

$ ocamlc fizzbuzz.ml
File "fizzbuzz.ml", line 10, characters 2-15:
Warning 5: this function application is partial,
maybe some arguments are missing.

Notes:
* The function type_approx does something similar.
* type_exp and other functions might also benefit from this.
* I have no idea whether the function final_subexpression
  belongs somewhere else.
* Feel free to change the name "final_subexpression" if
  you don't like it.
TagsNo tags attached.
Attached Filesdiff file icon typecore.ml.diff [^] (300 bytes) 2012-07-24 10:08 [Show Content]
? file icon fizzbuzz.ml [^] (266 bytes) 2012-07-24 10:26 [Show Content]

- Relationships

-  Notes
(0007799)
frisch (developer)
2012-07-24 10:58
edited on: 2012-07-24 11:44

Thanks! Committed to trunk (rev 12763), also treating other cases (if, try, match).

(0007800)
Drakken (reporter)
2012-07-24 11:44

Thanks, frisch. What about 4.00?
(0007801)
frisch (developer)
2012-07-24 11:45

4.00 is almost out. It's too late to add anything to it, except maybe fixes for serious bugs.

- Issue History
Date Modified Username Field Change
2012-07-24 10:08 Drakken New Issue
2012-07-24 10:08 Drakken File Added: typecore.ml.diff
2012-07-24 10:26 Drakken File Added: fizzbuzz.ml
2012-07-24 10:50 frisch Assigned To => frisch
2012-07-24 10:50 frisch Status new => assigned
2012-07-24 10:58 frisch Note Added: 0007799
2012-07-24 10:58 frisch Status assigned => resolved
2012-07-24 10:58 frisch Resolution open => fixed
2012-07-24 11:44 Drakken Note Added: 0007800
2012-07-24 11:44 frisch Note Edited: 0007799 View Revisions
2012-07-24 11:45 frisch Note Added: 0007801


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker