On the playground
use std
type u = union
`Foo int
`Bar
;;
const main = {
var v : u
match v
| `Foo 123: std.put("First branch\n")
| `Foo x: std.put("Got Foo {}\n", x)
| `Bar: std.put("Got Bar\n")
;;
}
Produces
Building
a.out...
6m -I /lib/myr in.myr
ld -o a.out /lib/myr/_myrrt.o in.o -L/lib/myr -L/lib/myr -lstd -lsys
First branch
But I would have expected a compile error.