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

Incompatibility check assumes abstracted type constructors are injective #5981

Closed
vicuna opened this issue Apr 11, 2013 · 1 comment
Closed

Incompatibility check assumes abstracted type constructors are injective #5981

vicuna opened this issue Apr 11, 2013 · 1 comment

Comments

@vicuna
Copy link

@vicuna vicuna commented Apr 11, 2013

Original bug ID: 5981
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2015-12-11T18:18:40Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.00.1
Fixed in version: 4.01.0+dev
Category: typing
Related to: #5989
Child of: #5998

Bug description

$ cat incompat.ml
module F(S : sig type 'a t end) =
struct

  type _ ab =
      A : int S.t ab
    | B : float S.t ab

  let f : int S.t ab -> float S.t ab -> string =
    fun (l : int S.t ab) (r : float S.t ab) -> match l, r with
      | A, B -> "f A B"
end

module M = F(struct type 'a t = unit end)

let () = print_endline M.(f A A)

$ ocaml incompat.ml
f A B

Additional information

Perhaps related to #5785.

@vicuna
Copy link
Author

@vicuna vicuna commented Apr 12, 2013

Comment author: @garrigue

Thanks for this report.
Indeed, while the handling of abstracted constructors was correct in mcomp, the code in unify3 was wrong.

Committed a preliminary fix in trunk. Will merge into 4.00 branch after more tests.

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

Successfully merging a pull request may close this issue.

None yet
3 participants