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

Erroneous refutation warning 56 with GADTs #7085

Closed
vicuna opened this issue Dec 11, 2015 · 2 comments
Closed

Erroneous refutation warning 56 with GADTs #7085

vicuna opened this issue Dec 11, 2015 · 2 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented Dec 11, 2015

Original bug ID: 7085
Reporter: @nojb
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:18:13Z)
Resolution: fixed
Priority: normal
Severity: major
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: typing

Bug description

The code (artificial, extracted from a larger code base)

module TypEq = struct
type (_, _) t = Eq : ('a, 'a) t
end

module type T = sig
type _ is_t = Is : ('a, 'b) TypEq.t -> 'a is_t
val is_t : unit -> unit is_t option
end

module Make (M : T) =
struct
let _ =
match M.is_t () with
| None -> 0
| Some _ -> 0
end

gives an (erroneous) warning 56 referring to the Some _ case in the pattern matching:

Warning 56: this match case is unreachable.
Consider replacing it with a refutation case ' -> .'

Switching the positions of the None case and the Some _ case makes the warning go away.

@vicuna
Copy link
Author

vicuna commented Dec 12, 2015

Comment author: @garrigue

The problem has been introduceed by commit 78a7a55.
Investigated the cause.

@vicuna
Copy link
Author

vicuna commented Dec 12, 2015

Comment author: @garrigue

Fixed in trunk at commit e0aec33.
Need to copy the type when potentially checking for GADTs.
Use the same do_init as for raising levels.

@vicuna vicuna closed this as completed Feb 16, 2017
@vicuna vicuna added the typing label Mar 14, 2019
@vicuna vicuna added this to the 4.03.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
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

2 participants