summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Eisenberg <eir@cis.upenn.edu>2014-12-16 17:15:49 -0500
committerRichard Eisenberg <eir@cis.upenn.edu>2014-12-19 10:02:30 -0500
commit02b4845e07ef7110b2f735f323eb8748903330ff (patch)
tree8e348ff19c7c4c79fe92dc7a5db51f658619bff6
parent5b8fa46ca37caa9ec83b217a697628135da34506 (diff)
downloadhaskell-02b4845e07ef7110b2f735f323eb8748903330ff.tar.gz
Consider equality contexts exotic, uninferrable by "deriving"
See comments in #8984. This takes back the fix for #6088.
-rw-r--r--compiler/typecheck/TcValidity.hs4
-rw-r--r--testsuite/tests/indexed-types/should_compile/all.T1
-rw-r--r--testsuite/tests/indexed-types/should_fail/T6088.hs (renamed from testsuite/tests/indexed-types/should_compile/T6088.hs)0
-rw-r--r--testsuite/tests/indexed-types/should_fail/T6088.stderr4
-rw-r--r--testsuite/tests/indexed-types/should_fail/all.T2
5 files changed, 7 insertions, 4 deletions
diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs
index 8575cf852f..ca8b63a441 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 ae15c272eb..928a70da70 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
index 2c9a592eae..2c9a592eae 100644
--- a/testsuite/tests/indexed-types/should_compile/T6088.hs
+++ b/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 0000000000..221dd32920
--- /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 821342cdfa..a52e6217e0 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, [''])
+