summaryrefslogtreecommitdiff
path: root/test/c/int_struct_constrained.sail
blob: 95cb6e9b5cf812d96723f554bb35e1b9ea985562 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
default Order dec

$include <prelude.sail>

val print = "print_endline" : string -> unit

struct Foo('n: Int), 'n <= 64 = {
  field: bits('n)
}

type Foo32 = Foo(32)

function bar(foo: Foo32) -> unit = {
  if foo.field == 0xFFFF_FFFF then {
    print("A")
  } else {
    print("B")
  }
}

function main((): unit) -> unit = {
  let x: Foo32 = struct { field = 0xFFFF_FFFF };
  bar(x)
}