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

Extremely cryptic error on type escaping before its definition #6734

Closed
vicuna opened this issue Dec 26, 2014 · 1 comment
Closed

Extremely cryptic error on type escaping before its definition #6734

vicuna opened this issue Dec 26, 2014 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Dec 26, 2014

Original bug ID: 6734
Reporter: @whitequark
Assigned to: @whitequark
Status: closed (set by @whitequark on 2015-01-02T10:58:24Z)
Resolution: duplicate
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #6171
Monitored by: @hcarty

Bug description

Consider this simple example:

let t = Hashtbl.create(1)
type u  = { v : unit }
let f () = let {v} = Hashtbl.find t "" in ()

The error message it produces is:

File "t.ml", line 5, characters 21-38:
Error: This expression has type u but an expression was expected of type u
       The type constructor u would escape its scope

The first line is plain out bizarre. The second one is understandable... in hindsight. It did not occur to me that this would be the cause of the message until I terminally reduced the example...

@vicuna
Copy link
Author

vicuna commented Jan 2, 2015

Comment author: @johnwhitington

See discussion at #6171

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

1 participant