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

Refine error message for erroneous partial application #7221

Closed
vicuna opened this issue Apr 11, 2016 · 3 comments
Closed

Refine error message for erroneous partial application #7221

vicuna opened this issue Apr 11, 2016 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Apr 11, 2016

Original bug ID: 7221
Reporter: @whitequark
Status: acknowledged (set by @damiendoligez on 2017-04-14T14:37:08Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.03.0+dev / +beta1
Category: typing
Monitored by: @gasche @hcarty

Bug description

Let's look at this case:

# let f a b = ();;
val f : 'a -> 'b -> unit = <fun>
# f 1; ();;
Characters 0-3:
Warning 5: this function application is partial, maybe some arguments are missing.

So far so good. Now let's look at this case:

# let g x = x + 1;;
val g : int -> int = <fun>
# g (f 1);;
Error: This expression has type 'a -> unit but an expression was expected of type int

This isn't too bad too, but this can be much improved by detecting that a partial application was lexically present in a context where a non-function type was inferred, and adding "maybe some arguments are missing" to this one as well.

An additional incentive to fix this is that this class of bug is a very common novice problem, especially for people unaccustomed with currying.

@github-actions
Copy link

github-actions bot commented May 9, 2020

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.

@github-actions github-actions bot added the Stale label May 9, 2020
@whitequark
Copy link
Member

Still a problem.

@stedolan
Copy link
Contributor

stedolan commented Jun 2, 2020

Fixed in #9560

@stedolan stedolan closed this as completed Jun 2, 2020
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