From 17a2c725ace3b2382582915a02b9b4c64f4d167d Mon Sep 17 00:00:00 2001 From: Alasdair Date: Fri, 5 Jun 2020 15:03:39 +0100 Subject: Generate nice error messages for patterns woth duplicate bindings --- test/typecheck/fail/duplicate_binding.expect | 11 +++++++++++ test/typecheck/fail/duplicate_binding.sail | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/typecheck/fail/duplicate_binding.expect create mode 100644 test/typecheck/fail/duplicate_binding.sail (limited to 'test') 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 + +function main() : unit -> unit = { + let (x, x) = (true, false); + () +} -- cgit v1.2.3