summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/typecheck/fail/duplicate_ctor.expect6
-rw-r--r--test/typecheck/fail/duplicate_ctor.sail3
-rw-r--r--test/typecheck/fail/duplicate_toplevel_let.expect6
-rw-r--r--test/typecheck/fail/duplicate_toplevel_let.sail10
-rw-r--r--test/typecheck/fail/duplicate_type_id.expect6
-rw-r--r--test/typecheck/fail/duplicate_type_id.sail3
6 files changed, 34 insertions, 0 deletions
diff --git a/test/typecheck/fail/duplicate_ctor.expect b/test/typecheck/fail/duplicate_ctor.expect
new file mode 100644
index 00000000..ac07c644
--- /dev/null
+++ b/test/typecheck/fail/duplicate_ctor.expect
@@ -0,0 +1,6 @@
+Type error:
+[duplicate_ctor.sail]:3:15-19
+3 |union foo2 = { Bar1 : int }
+  | ^--^
+  | A union constructor or function already exists with name Bar1
+  |
diff --git a/test/typecheck/fail/duplicate_ctor.sail b/test/typecheck/fail/duplicate_ctor.sail
new file mode 100644
index 00000000..44a133d3
--- /dev/null
+++ b/test/typecheck/fail/duplicate_ctor.sail
@@ -0,0 +1,3 @@
+union foo1 = { Bar1 : int }
+
+union foo2 = { Bar1 : int } \ No newline at end of file
diff --git a/test/typecheck/fail/duplicate_toplevel_let.expect b/test/typecheck/fail/duplicate_toplevel_let.expect
new file mode 100644
index 00000000..431e182b
--- /dev/null
+++ b/test/typecheck/fail/duplicate_toplevel_let.expect
@@ -0,0 +1,6 @@
+Type error:
+[duplicate_toplevel_let.sail]:6:4-14
+6 |let X: int = 4
+  | ^--------^
+  | Duplicate toplevel let binding X
+  |
diff --git a/test/typecheck/fail/duplicate_toplevel_let.sail b/test/typecheck/fail/duplicate_toplevel_let.sail
new file mode 100644
index 00000000..218e6592
--- /dev/null
+++ b/test/typecheck/fail/duplicate_toplevel_let.sail
@@ -0,0 +1,10 @@
+default Order dec
+
+$include <prelude.sail>
+
+let X: int = 3
+let X: int = 4
+
+function main() -> unit = {
+ print_int("X = ", X)
+}
diff --git a/test/typecheck/fail/duplicate_type_id.expect b/test/typecheck/fail/duplicate_type_id.expect
new file mode 100644
index 00000000..1cd2f4a8
--- /dev/null
+++ b/test/typecheck/fail/duplicate_type_id.expect
@@ -0,0 +1,6 @@
+Type error:
+[duplicate_type_id.sail]:3:6-10
+3 |union foo1 = { Bar2 : unit }
+  | ^--^
+  | Cannot create variant foo1, type name is already bound
+  |
diff --git a/test/typecheck/fail/duplicate_type_id.sail b/test/typecheck/fail/duplicate_type_id.sail
new file mode 100644
index 00000000..fe600096
--- /dev/null
+++ b/test/typecheck/fail/duplicate_type_id.sail
@@ -0,0 +1,3 @@
+union foo1 = { Bar1 : unit }
+
+union foo1 = { Bar2 : unit } \ No newline at end of file