1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
default Order dec
$include <prelude.sail>
struct foo = {
f1 : int,
f2 : int,
f3 : int,
}
function bar(x: foo) -> unit = {
match x {
struct { _ } => ()
};
match x {
struct { f1 = _, f2 = _, f3 = _ } => ()
};
match x {
struct { f1 = 0, f2 = _, _ } => (),
struct { f1 = _, f2 = 0, _ } => (),
struct { f1 = x, f2 = y, _ } => (),
}
}
struct baz('n), 'n in {32, 64} = {
len : int('n),
value : bits('n),
}
function quux forall 'n, 'n == 32. (x: baz('n)) -> unit = {
match x {
struct { len = 32, value = _ } => ()
}
}
function quux2 forall 'n, 'n in {32, 64}. (x: baz('n)) -> unit = {
match x {
struct { len = 32, value = _ } => (),
struct { len = 64, _ } => (),
}
}
|