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

[@@unboxed] triggers warning 4 (fragile pattern matching) #7471

Closed
vicuna opened this issue Jan 28, 2017 · 1 comment
Closed

[@@unboxed] triggers warning 4 (fragile pattern matching) #7471

vicuna opened this issue Jan 28, 2017 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Jan 28, 2017

Original bug ID: 7471
Reporter: antron
Status: closed (set by @mshinwell on 2017-03-10T08:25:48Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.04.0
Category: typing
Duplicate of: #7451

Bug description

See code below.

Steps to reproduce

repro.ml:

type t = Wrap of unit
[@@ocaml.unboxed]

let () =
let wrapped = () in
let wrapper = Wrap wrapped in

assert (Obj.repr wrapped == Obj.repr wrapper);

let Wrap () = wrapper in

match wrapper with
| Wrap () -> ()

Compiling this with

ocamlfind opt -w +A -linkpkg repro.ml

results in the output:

File "repro.ml", line 10, characters 6-13:
Warning 4: this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type t.
File "repro.ml", line 12, characters 2-38:
Warning 4: this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type t.

If the [@@unboxed] attribute is removed from type t, no warnings are emitted. I expected no warnings with and without the attribute.

@vicuna
Copy link
Author

vicuna commented Jan 28, 2017

Comment author: antron

My apologies, somehow hadn't found the other issue when searching. Thank you.

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

1 participant