summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU-EUROPE\dimitris <dimitris@MSRC-1361792.europe.corp.microsoft.com>2011-04-27 11:04:02 +0100
committerU-EUROPE\dimitris <dimitris@MSRC-1361792.europe.corp.microsoft.com>2011-04-27 11:04:02 +0100
commitb30f8b6540eb8fe10f06c6e12d0daa08464656c2 (patch)
treefe4d32642e6e5eee28a872ce1a05078cf17494ea
parent93b6e53272695a66d97bd2672dd366797176d5c5 (diff)
downloadhaskell-b30f8b6540eb8fe10f06c6e12d0daa08464656c2.tar.gz
Solving one IP from another. This fixes #5120.
-rw-r--r--compiler/typecheck/TcInteract.lhs13
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs
index 4a049aa3ee..fb6929ae45 100644
--- a/compiler/typecheck/TcInteract.lhs
+++ b/compiler/typecheck/TcInteract.lhs
@@ -1049,9 +1049,16 @@ doInteractWithInert (CIPCan { cc_id = id1, cc_flavor = ifl, cc_ip_nm = nm1, cc_i
| nm1 == nm2
= -- See Note [When improvement happens]
do { co_var <- newCoVar ty2 ty1 -- See Note [Efficient Orientation]
- ; let flav = Wanted (combineCtLoc ifl wfl)
- ; cans <- mkCanonical flav co_var
- ; mkIRContinue "IP/IP fundep" workItem KeepInert cans }
+ ; let flav = Wanted (combineCtLoc ifl wfl)
+ ; cans <- mkCanonical flav co_var
+ ; case wfl of
+ Given {} -> pprPanic "Unexpected given IP" (ppr workItem)
+ Derived {} -> pprPanic "Unexpected derived IP" (ppr workItem)
+ Wanted {} ->
+ do { setIPBind (cc_id workItem) $
+ EvCast id1 (mkSymCoercion (mkCoVarCoercion co_var))
+ ; mkIRStopK "IP/IP interaction (solved)" cans }
+ }
-- Never rewrite a given with a wanted equality, and a type function
-- equality can never rewrite an equality. We rewrite LHS *and* RHS