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
Assignees
Labels
bug typing typing-GADTS GADT typing and exhaustiveness bugs

Comments

@vicuna
Copy link

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 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.

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added the typing label Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
@Octachron Octachron added the typing-GADTS GADT typing and exhaustiveness bugs label May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug typing typing-GADTS GADT typing and exhaustiveness bugs
Projects
None yet
Development

No branches or pull requests

3 participants