summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/typecheck/pass/enum_cast.sail15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/typecheck/pass/enum_cast.sail b/test/typecheck/pass/enum_cast.sail
new file mode 100644
index 00000000..291eaff4
--- /dev/null
+++ b/test/typecheck/pass/enum_cast.sail
@@ -0,0 +1,15 @@
+default Order dec
+
+$include <prelude.sail>
+
+enum E = {A, B, C}
+
+val cast E_cast : E -> {'e, 0 <= 'e <= 2. atom('e)}
+function E_cast(e) = num_of_E(e)
+
+val main : unit -> unit
+
+function main() = {
+ let x : vector(3, dec, int) = [1, 2, 3];
+ print_int("x = ", x[B])
+}