Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005874OCamltypingpublic2013-01-05 23:412017-03-07 13:43
Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionundecidedFixed 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
TagsNo tags attached.
Attached Files? file icon [^] (11,727 bytes) 2013-05-10 16:46 [Show Content]

- Relationships

-  Notes
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.
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)..
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
hongboz (developer)
2013-05-10 16:50

Other analysis would help
type a = big_type list
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:
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 => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-22 22:06 doligez Target Version undecided => 4.02.2+dev / +rc1
2015-02-25 23:27 doligez Target Version 4.02.2+dev / +rc1 => 4.03.0+dev / +beta1
2016-04-14 17:28 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2017-02-16 14:01 doligez Target Version 4.03.1+dev => undecided
2017-02-23 16:45 doligez Category OCaml typing => typing
2017-03-07 13:43 shinwell Severity tweak => feature

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker