Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007221OCamltypingpublic2016-04-11 22:252017-04-14 16:37
Assigned To 
PlatformOSOS Version
Product Version4.03.0+dev / +beta1 
Target VersionFixed in Version 
Summary0007221: Refine error message for erroneous partial application
DescriptionLet'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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2016-04-11 22:25 whitequark New Issue
2016-12-07 18:55 shinwell Category OCaml general => OCaml typing
2017-02-23 16:45 doligez Category OCaml typing => typing
2017-04-14 16:37 doligez Status new => acknowledged

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker