Consider equality contexts exotic, uninferrable by "deriving"
authorRichard Eisenberg <eir@cis.upenn.edu>
Tue, 16 Dec 2014 22:15:49 +0000 (17:15 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Fri, 19 Dec 2014 15:02:30 +0000 (10:02 -0500)
See comments in #8984. This takes back the fix for #6088.

compiler/typecheck/TcValidity.hs
testsuite/tests/indexed-types/should_compile/all.T
testsuite/tests/indexed-types/should_fail/T6088.hs [moved from testsuite/tests/indexed-types/should_compile/T6088.hs with 100% similarity]
testsuite/tests/indexed-types/should_fail/T6088.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T

index 8575cf8..ca8b63a 100644 (file)
@@ -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
index ae15c27..928a70d 100644 (file)
@@ -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_fail/T6088.stderr b/testsuite/tests/indexed-types/should_fail/T6088.stderr
new file mode 100644 (file)
index 0000000..221dd32
--- /dev/null
@@ -0,0 +1,4 @@
+
+T6088.hs:16:33:
+    Couldn't match type ‘Pos n’ with ‘True’
+    When deriving the instance for (C (B n))
index 821342c..a52e621 100644 (file)
@@ -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, [''])
+