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

Improve GADT typing with or-clauses #7091

Closed
vicuna opened this issue Dec 13, 2015 · 1 comment
Closed

Improve GADT typing with or-clauses #7091

vicuna opened this issue Dec 13, 2015 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Dec 13, 2015

Original bug ID: 7091
Reporter: @Chris00
Assigned to: @garrigue
Status: assigned (set by @alainfrisch on 2017-02-22T16:15:15Z)
Resolution: open
Priority: normal
Severity: feature
Platform: x86_64
OS: GNU/Linux
OS Version: Debian testing
Target version: undecided
Category: typing
Duplicate of: #7319
Monitored by: runhang @hcarty @Chris00

Bug description

# type 'a a = A : int a | B : float a | C : int a;;
# let f : type v. v a -> int = function A -> 1 | B -> 2 | C -> 1;;
val f : 'v a -> int = <fun>

works fine. However:

# let f : type v. v a -> int = function A | C -> 1 | B -> 2;;
Characters 38-39:
  let f : type v. v a -> int = function A | C -> 1 | B -> 2;;
                                        ^
Error: This pattern matches values of type int a
       but a pattern was expected which matches values of type v a
       Type int is not compatible with type v 

This is rather surprising and should be fixed if possible (at least the error which really points in the wrong direction).

@vicuna
Copy link
Author

vicuna commented Dec 15, 2015

Comment author: runhang

I have the same complaint.

iirc, Jacques talked about this somewhere on Mantis already. The or-pattern here is wrong, but I agree there should be some fix, at least the error message, which is really not helpful.

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

No branches or pull requests

3 participants