Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005874OCamlOCaml typingpublic2013-01-05 23:412014-07-16 20:48
Reporterhongboz 
Assigned To 
PrioritynormalSeveritytweakReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target Versionafter-4.02.0Fixed in Version 
Summary0005874: Improve error message for polymorphic variant
DescriptionPolymorphic variant is really a nice feature, but it's not widely used due to a not very instructive error message (I guess). In most cases, some errors are caused by a typo(the variant name typed wrong, or the arity lost), I think it may not be too hard to give some suggestions instead of a very large error string which may scared the users
Thanks!
TagsNo tags attached.
Attached Files? file icon tmp.ml [^] (11,727 bytes) 2013-05-10 16:46 [Show Content]

- Relationships

-  Notes
(0008700)
gasche (developer)
2013-01-06 15:41

Regarding typos, I think we could do something along the following lines: when there is an unification mismatch between two variant types, check the labels that appear in one but not the other with the typo-finding algorith, using the set of labels on the other side as dictionary. Maybe this should be restricted to annotation propagation, deciding to trust the annotation rather than the term.
(0008701)
hongboz (developer)
2013-01-06 18:33

I agree, the type annotation should help to give a more friendly hint.

And it may be helpful to offer two errors mode, one is abbreviate which provides most useful content, another is verbose mode.

Sometimes the error message I got is like 20 pages long(two module types unification mismatch)..
(0009266)
hongboz (developer)
2013-05-10 16:47

In some cases, when type a mis-match type b, the compiler simply dumps the two types. Suppose type a is big, the error message is ridiculously large.
Some simple analysis would help a lot, suppose a is a concrete type while b is a function type, the compiler could emit a more friendly error message(see tmp.ml)
(0009268)
hongboz (developer)
2013-05-10 16:50

Other analysis would help
suppose
type a = big_type list
while
type b = big_type array

when type a mis-matches type b,
the compiler only need tell me one is list the other is array instead of dumping the two types

- Issue History
Date Modified Username Field Change
2013-01-05 23:41 hongboz New Issue
2013-01-06 15:41 gasche Note Added: 0008700
2013-01-06 18:33 hongboz Note Added: 0008701
2013-05-10 16:46 hongboz File Added: tmp.ml
2013-05-10 16:47 hongboz Note Added: 0009266
2013-05-10 16:50 hongboz Note Added: 0009268
2013-06-18 16:01 doligez Severity minor => tweak
2013-06-18 16:01 doligez Status new => confirmed
2013-06-18 16:01 doligez Target Version => 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
2014-07-16 20:48 doligez Target Version 4.02.0+dev => after-4.02.0


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker