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

Specifying concrete types as type parameters instead of vars fails typing #113

Closed
j14159 opened this issue Jan 28, 2017 · 0 comments · Fixed by #116
Closed

Specifying concrete types as type parameters instead of vars fails typing #113

j14159 opened this issue Jan 28, 2017 · 0 comments · Fixed by #116

Comments

@j14159
Copy link
Collaborator

j14159 commented Jan 28, 2017

This fails, the typer tries to unify t_int and undefined:

module n
type opt 'a = Some 'a | None
type u = U opt int
let f () = U Some 1

This also fails with the same basic unification error:

module m
export_type t
type t 'a = T 'a

module n
type u 'a = U m.t 'a
let f () = U m.T 1

I haven't dug in too deeply yet but I expect what's happening is that when we do:

type option 'a = Some 'a | None
type something_else = option int

The parser has no idea that int is supposed to be assigned to a variable 'a (or any variable, for that matter) and so trying to get that variable from the vars proplist in an #adt{} yields undefined.

I think the fix might be pretty simple: when we look through the parameters given for a type that's a member of another type, we just manufacture a new type variable for each type expression that isn't already a type var.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant