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

Non-compatibility assumed between concrete types with same constructor #5997

Closed
vicuna opened this issue Apr 22, 2013 · 1 comment
Closed
Assignees
Labels
bug typing typing-GADTS GADT typing and exhaustiveness bugs

Comments

@vicuna
Copy link

vicuna commented Apr 22, 2013

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

Bug description

type (_, _) comp =
| Eq : ('a, 'a) comp
| Diff : ('a, 'b) comp

module U = struct type t = T end

module M : sig
type t = T
val comp : (U.t, t) comp
end = struct
include U
let comp = Eq
end

match M.comp with | Diff -> false;;

  • : bool = false

I checked this example against both the trunk (in particular after the recent "incompatibility check" fixes) and the non-vanishing branch.

@vicuna
Copy link
Author

vicuna commented Apr 23, 2013

Comment author: @garrigue

Fix in trunk and 4.00, commits 13586 and 13587.

This was a particularly stupid bug:
constructors were compared by id rather than by name, and as a result independent copies of the same definition were all incompatible.
Also fixed the same problem for records.

@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