diff options
| author | Brian Campbell | 2019-04-25 17:12:37 +0100 |
|---|---|---|
| committer | Brian Campbell | 2019-04-25 17:12:37 +0100 |
| commit | d750f3e9256bba43d2eca33f0a4e9ad52e33e72e (patch) | |
| tree | c286ef3e10f4e69175a2917b52ffb240f2245edd /test | |
| parent | b21fed7a0583be8f220c96aa26532e2d88d59bc0 (diff) | |
Get basic constructor monomorphisation working again
- updates for type checking changes
- handle a little more pattern matching in constant propagation
- fix bug where false positive warnings were produced
- ensure bitvectors in tuples are always monomorphised (to catch the case
where the bitvectors only appear alone with a constant size)
Diffstat (limited to 'test')
| -rw-r--r-- | test/mono/not-yet/union-exist_manual | 1 | ||||
| -rw-r--r-- | test/mono/pass/union-exist (renamed from test/mono/not-yet/union-exist) | 0 | ||||
| -rw-r--r-- | test/mono/pass/union-exist_manual | 1 | ||||
| -rw-r--r-- | test/mono/union-exist.sail | 25 |
4 files changed, 9 insertions, 18 deletions
diff --git a/test/mono/not-yet/union-exist_manual b/test/mono/not-yet/union-exist_manual deleted file mode 100644 index d35c3d48..00000000 --- a/test/mono/not-yet/union-exist_manual +++ /dev/null @@ -1 +0,0 @@ -union-exist.sail -mono_split union-exist.sail:9:v
\ No newline at end of file diff --git a/test/mono/not-yet/union-exist b/test/mono/pass/union-exist index ebb89267..ebb89267 100644 --- a/test/mono/not-yet/union-exist +++ b/test/mono/pass/union-exist diff --git a/test/mono/pass/union-exist_manual b/test/mono/pass/union-exist_manual new file mode 100644 index 00000000..54deb7d8 --- /dev/null +++ b/test/mono/pass/union-exist_manual @@ -0,0 +1 @@ +union-exist.sail -mono_split union-exist.sail:10:v diff --git a/test/mono/union-exist.sail b/test/mono/union-exist.sail index f1e01e75..ca953b3c 100644 --- a/test/mono/union-exist.sail +++ b/test/mono/union-exist.sail @@ -1,32 +1,23 @@ default Order dec -type bits ('n : Int) = vector('n, dec, bit) -val operator & = "and_bool" : (bool, bool) -> bool -val eq_vec = {ocaml: "eq_list", lem: "eq_vec"} : forall 'n. (bits('n), bits('n)) -> bool -val eq_int = {ocaml: "eq_int", lem: "eq"} : (int, int) -> bool -overload operator == = {eq_int, eq_vec} -val vector_subrange = {ocaml: "subrange", lem: "subrange_vec_dec"} : forall ('n : Int) ('m : Int) ('o : Int), 'o <= 'm <= 'n. - (bits('n), atom('m), atom('o)) -> bits('m - ('o - 1)) - +$include <prelude.sail> union myunion = { - MyConstr : {'n, 'n in {8,16}. (atom('n),bits('n))} + MyConstr : {'n, 'n in {8,16}. (int('n),bits('n))} } val make : bits(2) -> myunion function make(v) = - /* Can't mention these below without running into exp/nexp parsing conflict! */ - let eight = 8 in let sixteen = 16 in - let r : {'n, 'n in {8,16}. (atom('n),bits('n))} = match v { - 0b00 => ( eight, 0x12), - 0b01 => (sixteen,0x1234), - 0b10 => ( eight, 0x56), - 0b11 => (sixteen,0x5678) + let r : {'n, 'n in {8,16}. (int('n),bits('n))} = match v { + 0b00 => ( 8, 0x12), + 0b01 => (16,0x1234), + 0b10 => ( 8, 0x56), + 0b11 => (16,0x5678) } in MyConstr(r) val use : myunion -> bits(32) -function use(MyConstr((n,v) as (atom('n),bits('n)))) = extz(v) +function use(MyConstr(n,v)) = sail_zero_extend(v,32) val run : unit -> unit effect {escape} |
