summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2018-06-25 11:42:46 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2018-06-25 13:21:33 +0100
commit2896082ec79f02b6388e038a8dae6cb22fe72dfc (patch)
tree953e081269c05dde609d61365960620b26b25d7a /testsuite/tests
parent5db9f9129e7519db0c9841fbe7c14f350c23284c (diff)
downloadhaskell-2896082ec79f02b6388e038a8dae6cb22fe72dfc.tar.gz
Fix error recovery for pattern synonyms
As Trac #15289 showed, we were carrying on after a type error in a pattern synonym, and then crashing. This patch improves error handling for pattern synonyms. I also moved a bit of code from TcBinds into TcPatSyn, which helpfully narrows the API.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/patsyn/should_fail/T15289.stderr21
-rw-r--r--testsuite/tests/patsyn/should_fail/all.T2
2 files changed, 14 insertions, 9 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T15289.stderr b/testsuite/tests/patsyn/should_fail/T15289.stderr
index b19d7a0d6b..952d358692 100644
--- a/testsuite/tests/patsyn/should_fail/T15289.stderr
+++ b/testsuite/tests/patsyn/should_fail/T15289.stderr
@@ -1,8 +1,13 @@
- T15289.hs:5:16: error:
- • Couldn't match expected type ‘Maybe’ with actual type ‘Bool’
- • In the pattern: True
- In the pattern: True :: Maybe
- In the declaration for pattern synonym ‘What’
- |
- 5 | pattern What = True :: Maybe
- | ^^^^
+
+T15289.hs:5:16: error:
+ • Couldn't match expected type ‘Maybe’ with actual type ‘Bool’
+ • In the pattern: True
+ In the pattern: True :: Maybe
+ In the declaration for pattern synonym ‘What’
+
+T15289.hs:5:24: error:
+ • Expecting one more argument to ‘Maybe’
+ Expected a type, but ‘Maybe’ has kind ‘* -> *’
+ • In the type ‘Maybe’
+ In a pattern type signature: Maybe
+ In the pattern: True :: Maybe
diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T
index 269dc8d844..c029f20eb9 100644
--- a/testsuite/tests/patsyn/should_fail/all.T
+++ b/testsuite/tests/patsyn/should_fail/all.T
@@ -42,4 +42,4 @@ test('T14380', normal, compile_fail, [''])
test('T14498', normal, compile_fail, [''])
test('T14552', normal, compile_fail, [''])
test('T14507', normal, compile_fail, ['-dsuppress-uniques'])
-test('T15289', expect_broken(15289), compile_fail, [''])
+test('T15289', normal, compile_fail, [''])