Skip to content
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

Report unbound variables before other errors #6381

Closed
vicuna opened this issue Apr 25, 2014 · 4 comments
Closed

Report unbound variables before other errors #6381

vicuna opened this issue Apr 25, 2014 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Apr 25, 2014

Original bug ID: 6381
Reporter: @dbuenzli
Status: feedback (set by @mshinwell on 2014-05-30T12:29:06Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.01.0
Target version: later
Category: typing
Monitored by: @hcarty

Bug description

Would 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.

@vicuna
Copy link
Author

vicuna commented May 30, 2014

Comment author: @mshinwell

Does anyone else have any opinions on the proposal?

@vicuna
Copy link
Author

vicuna commented Jul 16, 2014

Comment author: @damiendoligez

Is it worth making the typechecker even more complex? I don't find the example particularly convincing.

@vicuna
Copy link
Author

vicuna commented Jan 15, 2015

Comment author: @alainfrisch

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.

@vicuna vicuna added the typing label Mar 14, 2019
@dbuenzli
Copy link
Contributor

Given the general scepticism I think this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants