summaryrefslogtreecommitdiff
path: root/test/c/poly_tup.sail
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-08-29 18:01:50 +0100
committerAlasdair Armstrong2018-08-29 18:35:50 +0100
commita5ad2059821b86ef26a86d78c40cc680c57aa94e (patch)
tree468eb6bb76f995fb24872e028b0f7a9c7af8f06a /test/c/poly_tup.sail
parent07e3591e2427db2d9407d554ac57984ca566c6ed (diff)
C: Fix some issues with tuples as arguments to polymorphic constructors
Now all we need to do is make sure the RISC-V builtins are mapped to the correct C functions, and RISC-V in C should work (hopefully). We're still missing some of the functions in sail.c for the mappings so those have to be implemented.
Diffstat (limited to 'test/c/poly_tup.sail')
-rw-r--r--test/c/poly_tup.sail19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/c/poly_tup.sail b/test/c/poly_tup.sail
new file mode 100644
index 00000000..3fac2de8
--- /dev/null
+++ b/test/c/poly_tup.sail
@@ -0,0 +1,19 @@
+default Order dec
+
+val "print" : string -> unit
+val "print_int" : (string, int) -> unit
+
+union option ('a : Type) = {
+ Some : 'a,
+ None : unit
+}
+
+function main() : unit -> unit = {
+ let r = (3, 2);
+ let o = Some(r);
+ match o {
+ Some(x, y) => print_int("x = ", x),
+ None() => ()
+ };
+ print("ok\n");
+} \ No newline at end of file