diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/c/anon_rec.expect | 1 | ||||
| -rw-r--r-- | test/c/anon_rec.sail | 12 | ||||
| -rw-r--r-- | test/c/poly_int_record.expect | 3 | ||||
| -rw-r--r-- | test/c/poly_int_record.sail | 21 | ||||
| -rw-r--r-- | test/c/poly_record.expect | 1 | ||||
| -rw-r--r-- | test/c/poly_record.sail | 18 | ||||
| -rw-r--r-- | test/typecheck/pass/anon_rec.sail | 12 |
7 files changed, 68 insertions, 0 deletions
diff --git a/test/c/anon_rec.expect b/test/c/anon_rec.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/anon_rec.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/anon_rec.sail b/test/c/anon_rec.sail new file mode 100644 index 00000000..17dd1e07 --- /dev/null +++ b/test/c/anon_rec.sail @@ -0,0 +1,12 @@ +default Order dec + +union Foo ('a : Type) = { + MkFoo : { field1 : 'a, field2 : int } +} + +val "print_endline" : string -> unit + +function main((): unit) -> unit = { + let _: Foo(unit) = MkFoo(struct { field1 = (), field2 = 22 }); + print_endline("ok") +} diff --git a/test/c/poly_int_record.expect b/test/c/poly_int_record.expect new file mode 100644 index 00000000..a8a10253 --- /dev/null +++ b/test/c/poly_int_record.expect @@ -0,0 +1,3 @@ +x = 1 +y = 2 +ok diff --git a/test/c/poly_int_record.sail b/test/c/poly_int_record.sail new file mode 100644 index 00000000..ebb18713 --- /dev/null +++ b/test/c/poly_int_record.sail @@ -0,0 +1,21 @@ +default Order dec + +val "print_endline" : string -> unit +val "print_int" : (string, int) -> unit + +struct S('a: Type) = { + field1 : ('a, 'a), + field2 : unit +} + +function main((): unit) -> unit = { + var s : S(range(0, 3)) = struct { field1 = (0, 3), field2 = () }; + s.field1 = (1, 2); + match s.field1 { + (x, y) => { + print_int("x = ", x); + print_int("y = ", y); + } + }; + print_endline("ok"); +} diff --git a/test/c/poly_record.expect b/test/c/poly_record.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/poly_record.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/poly_record.sail b/test/c/poly_record.sail new file mode 100644 index 00000000..afe1f144 --- /dev/null +++ b/test/c/poly_record.sail @@ -0,0 +1,18 @@ +default Order dec + +val "print_endline" : string -> unit + +struct S('a: Type) = { + field1 : 'a, + field2 : unit +} + +function f forall ('a :Type). (s: S('a)) -> unit = { + s.field2 +} + +function main((): unit) -> unit = { + let s : S(unit) = struct { field1 = (), field2 = () }; + f(s); + print_endline("ok"); +} diff --git a/test/typecheck/pass/anon_rec.sail b/test/typecheck/pass/anon_rec.sail new file mode 100644 index 00000000..17dd1e07 --- /dev/null +++ b/test/typecheck/pass/anon_rec.sail @@ -0,0 +1,12 @@ +default Order dec + +union Foo ('a : Type) = { + MkFoo : { field1 : 'a, field2 : int } +} + +val "print_endline" : string -> unit + +function main((): unit) -> unit = { + let _: Foo(unit) = MkFoo(struct { field1 = (), field2 = 22 }); + print_endline("ok") +} |
