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

"Unbound value" hint could be more useful on missing rec #7811

Closed
vicuna opened this issue Jun 23, 2018 · 2 comments
Closed

"Unbound value" hint could be more useful on missing rec #7811

vicuna opened this issue Jun 23, 2018 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jun 23, 2018

Original bug ID: 7811
Reporter: @whitequark
Assigned to: @gasche
Status: resolved (set by @gasche on 2018-06-23T08:30:04Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 4.06.1
Fixed in version: 4.08.0+dev/beta1/beta2
Category: lexing and parsing

Bug description

Try to compile e.g.

let add_type x = ()
let find_type x =
(* ... *) find_type x

This fails with:

Error: Unbound value find_type
Hint: Did you mean add_type?

It ought to say something like:

Error: Unbound value find_type
Hint: Did you mean to make find_type recursive?

@vicuna
Copy link
Author

vicuna commented Jun 23, 2018

Comment author: @gasche

This was implemented in trunk (not 4.07) by Armaël Guéneau:

let add_type x = ();;

val add_type : 'a -> unit =

let find_type x = (* ... *) find_type x;;

                          ^^^^^^^^^

Error: Unbound value find_type
Hint: Did you mean add_type?
Hint: If this is a recursive definition,
you should add the 'rec' keyword on line 1

@vicuna vicuna closed this as completed Jun 23, 2018
@vicuna
Copy link
Author

vicuna commented Jun 23, 2018

Comment author: @whitequark

Nice!

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