summaryrefslogtreecommitdiff
path: root/test/coq
diff options
context:
space:
mode:
authorBrian Campbell2018-12-27 15:17:41 +0000
committerBrian Campbell2018-12-27 15:38:30 +0000
commit1940388163a9379cd6c157f3636439a93c5d4b67 (patch)
treec54f699a59ab8e3512cd337c68264aabfccac293 /test/coq
parentcb5773b3b4d69750f9693e9c9f4e20de5e06ed3b (diff)
Coq: fix name clashes and instantiation calculation
Diffstat (limited to 'test/coq')
-rw-r--r--test/coq/pass/fncasts.sail21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/coq/pass/fncasts.sail b/test/coq/pass/fncasts.sail
new file mode 100644
index 00000000..a18c9ecc
--- /dev/null
+++ b/test/coq/pass/fncasts.sail
@@ -0,0 +1,21 @@
+default Order dec
+
+$include <prelude.sail>
+
+// Check that the Coq backend correctly inserts autocasts.
+
+// Here we need a cast after the call to concat to change 'n + 'm to 'm + 'n
+val cast_result : forall 'n 'm, 'n >= 0 & 'm >= 0. (bits('n), bits('m)) -> bits('m + 'n)
+function cast_result (v,w) = v @ w
+
+/* FIXME: ought to cast result as if there were a type annotation
+val no_call : forall 'n 'm, 'n > 0 & 'm > 0. bits('n + 'm) -> bits('m + 'n)
+function no_call(v) = v
+*/
+
+val div_ex : forall 'n 'm, 'n > 0 & 'm > 0. (atom('n), bits('n * 'm)) -> bits('m)
+
+// Here we need a cast before the call to div_ex to change 'n to 1*'n
+val cast_arg : forall 'n, 'n > 0. bits('n) -> bits('n)
+function cast_arg(v) = div_ex(1,v)
+