[commit: ghc] wip/rae-new-coercible: Finished removing inert_repr_eqs (2945111)
git at git.haskell.org
git at git.haskell.org
Sun Dec 7 19:10:01 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/rae-new-coercible
Link : http://ghc.haskell.org/trac/ghc/changeset/2945111811cc9bbc98ff573b2fdad9c27d780e79/ghc
>---------------------------------------------------------------
commit 2945111811cc9bbc98ff573b2fdad9c27d780e79
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date: Sun Dec 7 11:31:15 2014 -0500
Finished removing inert_repr_eqs
>---------------------------------------------------------------
2945111811cc9bbc98ff573b2fdad9c27d780e79
compiler/typecheck/TcInteract.lhs | 8 +++---
compiler/typecheck/TcSMonad.lhs | 4 +--
testsuite/tests/deriving/should_fail/T7148.stderr | 30 +++++++++++++---------
testsuite/tests/deriving/should_fail/T7148a.stderr | 19 ++++++++------
4 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs
index be60594..c95ebe2 100644
--- a/compiler/typecheck/TcInteract.lhs
+++ b/compiler/typecheck/TcInteract.lhs
@@ -43,6 +43,7 @@ import Pair (Pair(..))
import Unique( hasKey )
import FastString ( sLit )
import DynFlags
+import Data.List ( find )
import Util
\end{code}
@@ -688,9 +689,10 @@ lookupFlattenTyVar :: TyVarEnv EqualCtList -> TcTyVar -> TcType
-- ^ Look up a flatten-tyvar in the inert nominal TyVarEqs;
-- this is used only when dealing with a CFunEqCan
lookupFlattenTyVar inert_eqs ftv
- = case lookupVarEnv inert_eqs ftv of
- Just (CTyEqCan { cc_rhs = rhs } : _) -> rhs
- _ -> mkTyVarTy ftv
+ -- TODO (RAE): This is fishy. Why only return one equality?
+ = case lookupVarEnv inert_eqs ftv >>= find ((== NomEq) . ctEqRel) of
+ Just (CTyEqCan { cc_rhs = rhs }) -> rhs
+ _ -> mkTyVarTy ftv
reactFunEq :: CtEvidence -> TcTyVar -- From this :: F tys ~ fsk1
-> CtEvidence -> TcTyVar -- Solve this :: F tys ~ fsk2
diff --git a/compiler/typecheck/TcSMonad.lhs b/compiler/typecheck/TcSMonad.lhs
index 3675082..0135893 100644
--- a/compiler/typecheck/TcSMonad.lhs
+++ b/compiler/typecheck/TcSMonad.lhs
@@ -592,7 +592,7 @@ getUnsolvedInerts :: TcS ( Bag Implication
, Cts -- Insoluble
, Cts ) -- All others
getUnsolvedInerts
- = do { IC { inert_eqs = tv_eqs
+ = do { IC { inert_eqs = tv_eqs
, inert_funeqs = fun_eqs
, inert_irreds = irreds, inert_dicts = idicts
, inert_insols = insols } <- getInertCans
@@ -748,7 +748,7 @@ removeInertCt is ct =
is { inert_funeqs = delFunEq (inert_funeqs is) tf tys }
CTyEqCan { cc_tyvar = x, cc_rhs = ty } ->
- is { inert_eqs = delTyEq (inert_eqs is) x ty }
+ is { inert_eqs = delTyEq (inert_eqs is) x ty }
CIrredEvCan {} -> panic "removeInertCt: CIrredEvCan"
CNonCanonical {} -> panic "removeInertCt: CNonCanonical"
diff --git a/testsuite/tests/deriving/should_fail/T7148.stderr b/testsuite/tests/deriving/should_fail/T7148.stderr
index 4edb968..ba3a88b 100644
--- a/testsuite/tests/deriving/should_fail/T7148.stderr
+++ b/testsuite/tests/deriving/should_fail/T7148.stderr
@@ -1,14 +1,20 @@
-T7148a.hs:19:50:
- Couldn't match representation of type ‘b’ with that of ‘Result a b’
- ‘b’ is a rigid type variable bound by
- the type forall b1. Proxy b1 -> a -> Result a b1 at T7148a.hs:19:50
- arising from the coercion of the method ‘coerce’
- from type ‘forall b. Proxy b -> a -> Result a b’
- to type ‘forall b.
- Proxy b -> IS_NO_LONGER a -> Result (IS_NO_LONGER a) b’
+T7148.hs:27:40:
+ Occurs check: cannot construct the infinite type: b ~ Tagged a b
+ arising from the coercion of the method ‘iso2’
+ from type ‘forall b. SameType b () -> SameType b b’
+ to type ‘forall b. SameType b () -> SameType b (Tagged a b)’
Relevant role signatures:
- type role IS_NO_LONGER representational
- type role Result nominal nominal
- type role Proxy phantom
- When deriving the instance for (Convert (IS_NO_LONGER a))
+ type role Tagged phantom representational
+ type role SameType nominal nominal
+ When deriving the instance for (IsoUnit (Tagged a b))
+
+T7148.hs:27:40:
+ Occurs check: cannot construct the infinite type: b ~ Tagged a b
+ arising from the coercion of the method ‘iso1’
+ from type ‘forall b. SameType () b -> SameType b b’
+ to type ‘forall b. SameType () b -> SameType (Tagged a b) b’
+ Relevant role signatures:
+ type role Tagged phantom representational
+ type role SameType nominal nominal
+ When deriving the instance for (IsoUnit (Tagged a b))
diff --git a/testsuite/tests/deriving/should_fail/T7148a.stderr b/testsuite/tests/deriving/should_fail/T7148a.stderr
index 5f865d1..4edb968 100644
--- a/testsuite/tests/deriving/should_fail/T7148a.stderr
+++ b/testsuite/tests/deriving/should_fail/T7148a.stderr
@@ -1,11 +1,14 @@
T7148a.hs:19:50:
- Could not coerce from ‘Result a b’ to ‘b’
- because ‘Result a b’ and ‘b’ are different types.
- arising from the coercion of the method ‘coerce’ from type
- ‘forall b. Proxy b -> a -> Result a b’ to type
- ‘forall b. Proxy b -> IS_NO_LONGER a -> Result (IS_NO_LONGER a) b’
- Possible fix:
- use a standalone 'deriving instance' declaration,
- so you can specify the instance context yourself
+ Couldn't match representation of type ‘b’ with that of ‘Result a b’
+ ‘b’ is a rigid type variable bound by
+ the type forall b1. Proxy b1 -> a -> Result a b1 at T7148a.hs:19:50
+ arising from the coercion of the method ‘coerce’
+ from type ‘forall b. Proxy b -> a -> Result a b’
+ to type ‘forall b.
+ Proxy b -> IS_NO_LONGER a -> Result (IS_NO_LONGER a) b’
+ Relevant role signatures:
+ type role IS_NO_LONGER representational
+ type role Result nominal nominal
+ type role Proxy phantom
When deriving the instance for (Convert (IS_NO_LONGER a))
More information about the ghc-commits
mailing list