Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006381OCamlOCaml generalpublic2014-04-26 00:062015-01-15 15:08
Reporterdbuenzli 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusfeedbackResolutionopen 
PlatformOSOS Version
Product Version4.01.0 
Target Version4.03.0+devFixed in Version 
Summary0006381: Report unbound variables before other errors
DescriptionWould it be possible to always report unbound variable error before other errors ? Sometimes with optional arguments we get misleading errors. Here is an example:

# let f ?(opt = 2) x y = x + y;;
# f 2 zorglub 3;;
Error: The function applied to this argument has type ?opt:int -> int
This argument cannot be applied without label

Thanks.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0011598)
shinwell (developer)
2014-05-30 14:29

Does anyone else have any opinions on the proposal?
(0011860)
doligez (administrator)
2014-07-16 17:50

Is it worth making the typechecker even more complex? I don't find the example particularly convincing.
(0013110)
frisch (developer)
2015-01-15 15:08

> Would it be possible to always report unbound variable error before other errors ?

I don't see how this could be done (easily). Knowing which variable is in scope depends quite a bit on the rest of the type-checking process (think about local open, includes, inherit), so as long as the type-checker fails on the first error, I don't see how this could be implemented in general.

- Issue History
Date Modified Username Field Change
2014-04-26 00:06 dbuenzli New Issue
2014-05-30 14:29 shinwell Note Added: 0011598
2014-05-30 14:29 shinwell Status new => feedback
2014-07-16 17:50 doligez Note Added: 0011860
2014-07-16 17:50 doligez Target Version => 4.02.1+dev
2014-09-04 00:25 doligez Target Version 4.02.1+dev => undecided
2014-09-15 09:50 doligez Target Version undecided => 4.02.2+dev / +rc1
2015-01-15 00:53 doligez Target Version 4.02.2+dev / +rc1 => 4.03.0+dev
2015-01-15 15:08 frisch Note Added: 0013110


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker