Fix #10031 by inverting a critical test in kick_out.
authorRichard Eisenberg <eir@cis.upenn.edu>
Tue, 27 Jan 2015 16:40:26 +0000 (11:40 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Tue, 27 Jan 2015 19:18:29 +0000 (14:18 -0500)
Summary:
The documentation (Note [The flattening story] in TcFlatten) was
correct; it's just the implementation that was not.

Test in typecheck/should_compile/T10031

Test Plan: validate

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D630

GHC Trac Issues: #10031

compiler/typecheck/TcInteract.hs
testsuite/tests/typecheck/should_compile/T10031.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T

index 18ca270..aef934c 100644 (file)
@@ -1126,7 +1126,7 @@ kick_out new_flavour new_eq_rel new_tv (IC { inert_eqs      = tv_eqs
           | can_rewrite ev
           = case eq_rel of
               NomEq  -> not (rhs_ty `eqType` mkTyVarTy new_tv)
-              ReprEq -> isTyVarExposed new_tv rhs_ty
+              ReprEq -> not (isTyVarExposed new_tv rhs_ty)
 
           | otherwise
           = True
diff --git a/testsuite/tests/typecheck/should_compile/T10031.hs b/testsuite/tests/typecheck/should_compile/T10031.hs
new file mode 100644 (file)
index 0000000..4ed45d3
--- /dev/null
@@ -0,0 +1,5 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+module T10031 where
+import Data.Coerce
+coerce' :: Coercible b a => a -> b
+coerce' = coerce (\x -> x :: b) :: forall a b. Coercible b a => a -> b
index c292eaf..4348ea3 100644 (file)
@@ -441,3 +441,4 @@ test('T9939', normal, compile, [''])
 test('T9973', normal, compile, [''])
 test('T9971', normal, compile, [''])
 test('T9999', normal, compile, [''])
+test('T10031', normal, compile, [''])