summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-06-22 18:11:32 +0100
committerAlasdair Armstrong2017-06-22 18:11:32 +0100
commit41c5ae82e46fe06ab3a16d0759872a5a221f2da2 (patch)
tree9526c1bf4df2ab5477f4a23d03831c21bc1980ff /test
parent0af6fd21fdba71f7aae6d95ec758fdf86e4916a7 (diff)
Can now typecheck register declarations and assignments
Can now properly typecheck register declarations and assignments. Also better support for assignments to mutable variables. Assignment to immutable let bound variables is disallowed as it should be, and casts when assiging to existing bound variables should be handled properly. Added additional tests for these new features, and a new option -just_check that allows the new checker to be run without the old.
Diffstat (limited to 'test')
-rw-r--r--test/typecheck/fail/modify_assignment1.sail8
-rw-r--r--test/typecheck/fail/modify_assignment2.sail8
-rw-r--r--test/typecheck/fail/modify_let_bound.sail16
-rw-r--r--test/typecheck/fail/modify_type_chain1.sail8
-rw-r--r--test/typecheck/fail/modify_type_chain2.sail8
-rw-r--r--test/typecheck/fail/modify_type_chain3.sail8
-rw-r--r--test/typecheck/fail/modify_type_chain4.sail8
-rw-r--r--test/typecheck/fail/modify_type_chain5.sail8
-rw-r--r--test/typecheck/fail/reg_mod.sail11
-rw-r--r--test/typecheck/pass/modify_assignment1.sail8
-rw-r--r--test/typecheck/pass/modify_type_chain.sail8
-rw-r--r--test/typecheck/pass/reg_mod.sail11
12 files changed, 110 insertions, 0 deletions
diff --git a/test/typecheck/fail/modify_assignment1.sail b/test/typecheck/fail/modify_assignment1.sail
new file mode 100644
index 00000000..99adc95c
--- /dev/null
+++ b/test/typecheck/fail/modify_assignment1.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ z := 9;
+ z := 10
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_assignment2.sail b/test/typecheck/fail/modify_assignment2.sail
new file mode 100644
index 00000000..6551afff
--- /dev/null
+++ b/test/typecheck/fail/modify_assignment2.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:9|]) z := 9;
+ z := ([|0:10|]) 10
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_let_bound.sail b/test/typecheck/fail/modify_let_bound.sail
new file mode 100644
index 00000000..a2ad1b98
--- /dev/null
+++ b/test/typecheck/fail/modify_let_bound.sail
@@ -0,0 +1,16 @@
+
+default Order dec
+
+register bit[3] test
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ let i = 10 in {
+ i := 20
+ };
+ z := 9;
+ z := 10;
+ test := 3
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_type_chain1.sail b/test/typecheck/fail/modify_type_chain1.sail
new file mode 100644
index 00000000..3fff3b59
--- /dev/null
+++ b/test/typecheck/fail/modify_type_chain1.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:10|]) z := 9;
+ ([|0:9|]) z := ([|0:10|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_type_chain2.sail b/test/typecheck/fail/modify_type_chain2.sail
new file mode 100644
index 00000000..085e7db5
--- /dev/null
+++ b/test/typecheck/fail/modify_type_chain2.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:10|]) z := 9;
+ ([|0:7|]) z := ([|0:8|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_type_chain3.sail b/test/typecheck/fail/modify_type_chain3.sail
new file mode 100644
index 00000000..cfe532aa
--- /dev/null
+++ b/test/typecheck/fail/modify_type_chain3.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:6|]) z := 9;
+ ([|0:7|]) z := ([|0:8|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_type_chain4.sail b/test/typecheck/fail/modify_type_chain4.sail
new file mode 100644
index 00000000..c36a9086
--- /dev/null
+++ b/test/typecheck/fail/modify_type_chain4.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:10|]) z := 9;
+ ([|0:11|]) z := ([|0:13|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/fail/modify_type_chain5.sail b/test/typecheck/fail/modify_type_chain5.sail
new file mode 100644
index 00000000..3c3076a4
--- /dev/null
+++ b/test/typecheck/fail/modify_type_chain5.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:10|]) z := 9;
+ ([|0:9|]) z := ([|0:13|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/fail/reg_mod.sail b/test/typecheck/fail/reg_mod.sail
new file mode 100644
index 00000000..24b318b4
--- /dev/null
+++ b/test/typecheck/fail/reg_mod.sail
@@ -0,0 +1,11 @@
+
+register [|0:10|] reg
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ reg := 9;
+ reg := 10;
+ reg := 8
+} \ No newline at end of file
diff --git a/test/typecheck/pass/modify_assignment1.sail b/test/typecheck/pass/modify_assignment1.sail
new file mode 100644
index 00000000..1c7ab614
--- /dev/null
+++ b/test/typecheck/pass/modify_assignment1.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:10|]) z := 9;
+ z := ([|0:9|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/pass/modify_type_chain.sail b/test/typecheck/pass/modify_type_chain.sail
new file mode 100644
index 00000000..14651787
--- /dev/null
+++ b/test/typecheck/pass/modify_type_chain.sail
@@ -0,0 +1,8 @@
+
+val unit -> unit effect pure test
+
+function unit test () =
+{
+ ([|0:10|]) z := 9;
+ ([|0:9|]) z := ([|0:8|]) 8
+} \ No newline at end of file
diff --git a/test/typecheck/pass/reg_mod.sail b/test/typecheck/pass/reg_mod.sail
new file mode 100644
index 00000000..37c8d890
--- /dev/null
+++ b/test/typecheck/pass/reg_mod.sail
@@ -0,0 +1,11 @@
+
+register [|0:10|] reg
+
+val unit -> unit effect {wreg} test
+
+function unit test () =
+{
+ reg := 9;
+ reg := 10;
+ reg := 8
+} \ No newline at end of file