summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair2020-06-05 15:03:39 +0100
committerAlasdair2020-06-05 15:03:39 +0100
commit17a2c725ace3b2382582915a02b9b4c64f4d167d (patch)
tree3da196f1af4defac5693d2ab3b21cddfd06dc01d /test
parent0c324b359e156099b0c3015816f644fa90f455a7 (diff)
Generate nice error messages for patterns woth duplicate bindings
Diffstat (limited to 'test')
-rw-r--r--test/typecheck/fail/duplicate_binding.expect11
-rw-r--r--test/typecheck/fail/duplicate_binding.sail8
2 files changed, 19 insertions, 0 deletions
diff --git a/test/typecheck/fail/duplicate_binding.expect b/test/typecheck/fail/duplicate_binding.expect
new file mode 100644
index 00000000..cde78d77
--- /dev/null
+++ b/test/typecheck/fail/duplicate_binding.expect
@@ -0,0 +1,11 @@
+Type error:
+[duplicate_binding.sail]:6:10-11
+6 | let (x, x) = (true, false);
+  | ^
+  | Duplicate binding for x in pattern
+  | This error was caused by:
+  | [duplicate_binding.sail]:6:7-8
+  | 6 | let (x, x) = (true, false);
+  |  | ^
+  |  | Previous binding of x here
+  |
diff --git a/test/typecheck/fail/duplicate_binding.sail b/test/typecheck/fail/duplicate_binding.sail
new file mode 100644
index 00000000..e5c3d923
--- /dev/null
+++ b/test/typecheck/fail/duplicate_binding.sail
@@ -0,0 +1,8 @@
+default Order dec
+
+$include <prelude.sail>
+
+function main() : unit -> unit = {
+ let (x, x) = (true, false);
+ ()
+}