[commit: ghc] master: Consider equality contexts exotic, uninferrable by "deriving" (02b4845)
git at git.haskell.org
git at git.haskell.org
Fri Dec 19 15:02:15 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/02b4845e07ef7110b2f735f323eb8748903330ff/ghc
>---------------------------------------------------------------
commit 02b4845e07ef7110b2f735f323eb8748903330ff
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date: Tue Dec 16 17:15:49 2014 -0500
Consider equality contexts exotic, uninferrable by "deriving"
See comments in #8984. This takes back the fix for #6088.
>---------------------------------------------------------------
02b4845e07ef7110b2f735f323eb8748903330ff
compiler/typecheck/TcValidity.hs | 4 +---
testsuite/tests/indexed-types/should_compile/all.T | 1 -
.../tests/indexed-types/{should_compile => should_fail}/T6088.hs | 0
testsuite/tests/indexed-types/should_fail/T6088.stderr | 4 ++++
testsuite/tests/indexed-types/should_fail/all.T | 2 ++
5 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs
index 8575cf8..ca8b63a 100644
--- a/compiler/typecheck/TcValidity.hs
+++ b/compiler/typecheck/TcValidity.hs
@@ -878,10 +878,8 @@ validDerivPred :: TyVarSet -> PredType -> Bool
validDerivPred tv_set pred
= case classifyPredType pred of
ClassPred _ tys -> check_tys tys
- -- EqPred ReprEq is a Coercible constraint; treat
- -- like a class
- EqPred ReprEq ty1 ty2 -> check_tys [ty1, ty2]
TuplePred ps -> all (validDerivPred tv_set) ps
+ EqPred {} -> False -- reject equality constraints
_ -> True -- Non-class predicates are ok
where
check_tys tys = hasNoDups fvs
diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T
index ae15c27..928a70d 100644
--- a/testsuite/tests/indexed-types/should_compile/all.T
+++ b/testsuite/tests/indexed-types/should_compile/all.T
@@ -194,7 +194,6 @@ test('T6152',
run_command,
['$MAKE -s --no-print-directory T6152'])
-test('T6088', normal, compile, [''])
test('T7082', normal, compile, [''])
test('Overlap1', normal, compile, [''])
diff --git a/testsuite/tests/indexed-types/should_compile/T6088.hs b/testsuite/tests/indexed-types/should_fail/T6088.hs
similarity index 100%
rename from testsuite/tests/indexed-types/should_compile/T6088.hs
rename to testsuite/tests/indexed-types/should_fail/T6088.hs
diff --git a/testsuite/tests/indexed-types/should_fail/T6088.stderr b/testsuite/tests/indexed-types/should_fail/T6088.stderr
new file mode 100644
index 0000000..221dd32
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T6088.stderr
@@ -0,0 +1,4 @@
+
+T6088.hs:16:33:
+ Couldn't match type ‘Pos n’ with ‘True’
+ When deriving the instance for (C (B n))
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T
index 821342c..a52e621 100644
--- a/testsuite/tests/indexed-types/should_fail/all.T
+++ b/testsuite/tests/indexed-types/should_fail/all.T
@@ -132,3 +132,5 @@ test('T9580', normal, multimod_compile_fail, ['T9580', ''])
test('T9662', normal, compile_fail, [''])
test('T7862', normal, compile_fail, [''])
test('T9896', normal, compile_fail, [''])
+test('T6088', normal, compile_fail, [''])
+
More information about the ghc-commits
mailing list