diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-10-24 11:12:43 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-10-24 11:12:43 +0100 |
commit | d1eaeadb08c1412c1572124efaf341bdc0976ccb (patch) | |
tree | 1c9d84e98acb35cc4547eeb9d881e42166d1be67 /testsuite/tests/patsyn | |
parent | b10a768786f93d174b1cbc64ae8dae4fe60120bf (diff) | |
download | haskell-d1eaeadb08c1412c1572124efaf341bdc0976ccb.tar.gz |
Temporary fix to Trac #14380
This fix replaces an utterly bogus error message with a decent one,
rejecting a pattern synonym with a list pattern and rebindable syntax.
Not hard to fix properly, but I'm going to wait for a willing volunteer
and/or more user pressure.
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14380.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14380.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T14380.hs b/testsuite/tests/patsyn/should_fail/T14380.hs new file mode 100644 index 0000000000..aec398590d --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14380.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE PatternSynonyms #-} + +module T14380 where + +data Foo = Foo [Int] +pattern Bar :: Foo +pattern Bar = Foo [] diff --git a/testsuite/tests/patsyn/should_fail/T14380.stderr b/testsuite/tests/patsyn/should_fail/T14380.stderr new file mode 100644 index 0000000000..4228d2955c --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14380.stderr @@ -0,0 +1,9 @@ + +T14380.hs:8:15: error: + Invalid right-hand side of bidirectional pattern synonym βBarβ: + Pattern β[]β is not invertible + Suggestion: instead use an explicitly bidirectional pattern synonym, e.g. + pattern Bar <- Foo [] where Bar = ... + Reason: rebindable syntax is on. + This is fixable: add use-case to Trac #14380 + RHS pattern: Foo [] diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 8a098d9d1f..388e67b27b 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -38,3 +38,4 @@ test('T13349', normal, compile_fail, ['']) test('T13470', normal, compile_fail, ['']) test('T14112', normal, compile_fail, ['']) test('T14114', normal, compile_fail, ['']) +test('T14380', normal, compile_fail, ['']) |