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

Problem with forall and method #5322

Closed
vicuna opened this issue Jul 28, 2011 · 1 comment
Closed

Problem with forall and method #5322

vicuna opened this issue Jul 28, 2011 · 1 comment
Labels

Comments

@vicuna
Copy link

@vicuna vicuna commented Jul 28, 2011

Original bug ID: 5322
Reporter: poluxmoon
Status: closed (set by @garrigue on 2011-07-29T01:56:43Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.0
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Type error on code similar to :


type 'par t = 'par

let ident v = v

class alias =
object
method alias : 'a . 'a t -> 'a = ident (* type error here *)
end

Which gives :


Error: This expression has type 'a. 'a t -> 'a
but an expression was expected of type 'b. 'b t -> 'b
Type 'a a = 'a is not compatible with type 'b t = 'b

Additional information

The problem is related to unification of foralls containing named type in a method.
The compiler accepts equivalent code when not using the named type "t" or when not using a method (see attached file).

File attachments

@vicuna
Copy link
Author

@vicuna vicuna commented Jul 29, 2011

Comment author: @garrigue

Thanks for your report.
Both Ctype.unify3 and Ctype.moregen didn't consider the possibility that a type abbreviation may expand to a universal type variable.
This is now fixed in both trunk and 3.12 branch (revision 11159).

@vicuna vicuna closed this Jul 29, 2011
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant