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

Problem with GADTs and polymorphic variants #5689

Closed
vicuna opened this issue Jul 16, 2012 · 1 comment
Closed

Problem with GADTs and polymorphic variants #5689

vicuna opened this issue Jul 16, 2012 · 1 comment
Assignees
Labels
bug typing typing-GADTS GADT typing and exhaustiveness bugs
Milestone

Comments

@vicuna
Copy link

vicuna commented Jul 16, 2012

Original bug ID: 5689
Reporter: @lpw25
Assigned to: @garrigue
Status: closed (set by @garrigue on 2012-07-18T03:37:39Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.01.0+dev
Fixed in version: 4.00.0+dev
Category: typing
Child of: #5998
Monitored by: @lpw25 @hcarty

Bug description

As I understand it the types:

type inkind = [ Link | Nonlink ]

type _ inline_t =
| Text: string -> [< inkind > Nonlink ] inline_t | Bold: 'a inline_t list -> 'a inline_t | Link: string -> [< inkind > Link ] inline_t
| Mref: string * [ Nonlink ] inline_t list -> [< inkind > Link ] inline_t

should maintain the invariant that a Mref cannot contain another Mref or a Link, because these have type [< inkind > Link] and the Mref only accepts [ Nonlink ].

However the attached file uses GADTs to break this invariant producing a value:

val broken_invariant : inkind inline_t = Mref ("foo", [Link ])

File attachments

@vicuna
Copy link
Author

vicuna commented Jul 18, 2012

Comment author: @garrigue

Fixed in 4.00 and trunk, revisions 12726 and 12725.
Row fields should be handled as fixed when the row variable is a type constructor.

@vicuna vicuna closed this as completed Jul 18, 2012
@vicuna vicuna added the typing label Mar 14, 2019
@vicuna vicuna added this to the 4.01.0 milestone 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