diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-21 14:18:32 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-23 07:46:37 +0000 |
commit | c069be815aa0bce2eb2c9621a36f114badda2318 (patch) | |
tree | c2ca0da9aa43f40ca2787877870263adc989cadb /testsuite/tests/patsyn/should_fail | |
parent | 19632501654cac9d84088c69bd4291009292c5c3 (diff) | |
download | haskell-c069be815aa0bce2eb2c9621a36f114badda2318.tar.gz |
Add a pattern-syn form of PromotionErr
The main change is to add PatSynPE to PromotionErr, so that
when we get an ill-staged use of a pattern synonym we get a
civilised error message.
We were already doing this in half-baked form in tcValBinds, but
this patch tidies up the impl (which previously used a hack rather
than APromotionErr), and does it in tcTyClsInstDecls too.
Diffstat (limited to 'testsuite/tests/patsyn/should_fail')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T11265.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T11265.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T9161-1.stderr | 11 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T9161-2.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
5 files changed, 21 insertions, 6 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T11265.hs b/testsuite/tests/patsyn/should_fail/T11265.hs new file mode 100644 index 0000000000..a7ee5c4fbf --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T11265.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms, DataKinds #-} + +pattern A = True + +class F a +instance F A diff --git a/testsuite/tests/patsyn/should_fail/T11265.stderr b/testsuite/tests/patsyn/should_fail/T11265.stderr new file mode 100644 index 0000000000..eda5d35a9d --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T11265.stderr @@ -0,0 +1,6 @@ + +T11265.hs:6:12: error: + • Pattern synonym ‘A’ cannot be used here + (Pattern synonyms cannot be promoted) + • In the first argument of ‘F’, namely ‘A’ + In the instance declaration for ‘F A’ diff --git a/testsuite/tests/patsyn/should_fail/T9161-1.stderr b/testsuite/tests/patsyn/should_fail/T9161-1.stderr index 4e744694e2..04d9b31bf7 100644 --- a/testsuite/tests/patsyn/should_fail/T9161-1.stderr +++ b/testsuite/tests/patsyn/should_fail/T9161-1.stderr @@ -1,5 +1,6 @@ -
-T9161-1.hs:6:14: error:
- Pattern synonym ‘PATTERN’ used as a type
- In the type signature:
- wrongLift :: PATTERN
+ +T9161-1.hs:6:14: error: + • Pattern synonym ‘PATTERN’ cannot be used here + (Pattern synonyms cannot be promoted) + • In the type signature: + wrongLift :: PATTERN diff --git a/testsuite/tests/patsyn/should_fail/T9161-2.stderr b/testsuite/tests/patsyn/should_fail/T9161-2.stderr index b7a1f360d7..409b922776 100644 --- a/testsuite/tests/patsyn/should_fail/T9161-2.stderr +++ b/testsuite/tests/patsyn/should_fail/T9161-2.stderr @@ -1,6 +1,7 @@ T9161-2.hs:8:20: error: - • Pattern synonym ‘PATTERN’ used as a type + • Pattern synonym ‘PATTERN’ cannot be used here + (Pattern synonyms cannot be promoted) • In the first argument of ‘Proxy’, namely ‘PATTERN’ In the type signature: wrongLift :: Proxy PATTERN () diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 6ef64ae5ed..eeb405b316 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -27,3 +27,4 @@ test('export-type-synonym', normal, compile_fail, ['']) test('export-ps-rec-sel', normal, compile_fail, ['']) test('T11053', normal, compile, ['-fwarn-missing-pat-syn-sigs']) test('T10426', normal, compile_fail, ['']) +test('T11265', normal, compile_fail, ['']) |