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
Improve error message for polymorphic variant #5874
Comments
Comment author: @gasche 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. |
Comment author: @bobzhang 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).. |
Comment author: @bobzhang 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. |
Comment author: @bobzhang Other analysis would help when type a mis-matches type b, |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
Original bug ID: 5874
Reporter: @bobzhang
Status: confirmed (set by @damiendoligez on 2013-06-18T14:01:06Z)
Resolution: open
Priority: normal
Severity: feature
Target version: undecided
Category: typing
Monitored by: @gasche
Bug description
Polymorphic 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!
File attachments
The text was updated successfully, but these errors were encountered: