-
Notifications
You must be signed in to change notification settings - Fork 8
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
Ctype.Unify(_) error with higher-order example #15
Comments
The following code also raises module type T1 = sig type _ t end
implicit module Id = struct type 'a t = 'a end
let g : (implicit C:T1) -> (<f:'g. 'g -> 'g C.t>) -> unit = assert false
let _ = g (object method f : 'g. 'g -> 'g = assert false end) |
After b81ea30 fix, I think it is the same issue. I don't know how these unifications should be handled. The code dealing with this is: typeimplicit.ml:165. Here, This code is quite naive as I don't know enough about OCaml unification to properly handle all the cases… The environment and the unification function should be properly setup and selected so that call on line 168 succeed. |
We spend some time looking at that issue with @lpw25 . The unify error is likely because of unification with a univar which was put in the constraint list. Luckily, with implicits, we can make sure by construction that all type variables introduced appear only in the correct scope. typeimplicit.ml:62 is about sharing of introduced type variables: we introduce only one fresh type variable per equal types. The solution is:
|
Leo suggested we introduce a new constructor for type variables which are allowed to unify with some univars, something like: Tpolyvar of string list (* allowed univars *) * string option (* like usual Tvar *) |
I expect this can be simplified further:
The text was updated successfully, but these errors were encountered: