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

enrich "not a function" compile error with type information #5618

Closed
vicuna opened this issue May 17, 2012 · 1 comment
Closed

enrich "not a function" compile error with type information #5618

vicuna opened this issue May 17, 2012 · 1 comment
Assignees

Comments

@vicuna
Copy link

vicuna commented May 17, 2012

Original bug ID: 5618
Reporter: cfalls
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:04:43Z)
Resolution: fixed
Priority: low
Severity: feature
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

When there's a type error, and in particular I'm trying to use a non-function as a function, I wish the error message would include the specific types involved instead of just saying "not a function".

Steps to reproduce

let x = 3;;

val x : int = 3

List.map x [];;

Error: This expression has type int but an expression was expected of type
'a -> 'b

x 5;;

Error: This expression is not a function; it cannot be applied

Additional information

I'd like "x 5" above to produce an error more like "This expression is not a function and so cannot be applied. In particular, it has type int but an expression was expected of type int -> 'a".

I mention this mostly because there's a chance it's very easy to implement.

@vicuna
Copy link
Author

vicuna commented May 28, 2012

Comment author: @alainfrisch

Fixed in trunk (commit #12489).

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

2 participants