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

Strange restriction on unification between rigid and flexible variables #6264

Closed
vicuna opened this issue Dec 7, 2013 · 1 comment
Closed

Comments

@vicuna
Copy link

vicuna commented Dec 7, 2013

Original bug ID: 6264
Reporter: yann.regis-gianas
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:25:26Z)
Resolution: duplicate
Priority: normal
Severity: minor
Version: 4.01.0
Category: typing
Duplicate of: #6150

Bug description

The following program is rejected by the type-checker with a strange error message. Replacing 'a by _ make the type-checker happy. Is it a bug or a hard-to-explain restriction of the inference algorithm?

? src git:(master) ? ocaml
OCaml version 4.01.0

let f : type a. a -> int = fun x -> let y : 'a = x in 0;;

Characters 49-50:
let f : type a. a -> int = fun x -> let y : 'a = x in 0;;
^
Error: This expression has type a but an expression was expected of type a
The type constructor a would escape its scope

Steps to reproduce

Run ocaml 4.01.0 on the following phrase:

let f : type a. a -> int = fun x -> let y : 'a = x in 0;;

@vicuna
Copy link
Author

vicuna commented Dec 7, 2013

Comment author: @gasche

I believe this is a duplicate of #6150; this is related to the fragile scoping of type variables.

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