Fix Trac #3731: more superclass subtlety (sigh)
authorsimonpj@microsoft.com <unknown>
Tue, 14 Dec 2010 18:03:44 +0000 (18:03 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 14 Dec 2010 18:03:44 +0000 (18:03 +0000)
I will add more comments, but I want to commit this tonight,
so the overnight builds get it.

compiler/typecheck/TcCanonical.lhs

index 7fdb63e..60d1836 100644 (file)
@@ -320,7 +320,10 @@ happen.
 newSCWorkFromFlavored :: EvVar -> CtFlavor -> Class -> [Xi] -> TcS CanonicalCts
 -- Returns superclasses, see Note [Adding superclasses]
 newSCWorkFromFlavored ev orig_flavor cls xis 
-  = do { let (tyvars, sc_theta, _, _) = classBigSig cls 
+  | isEmptyVarSet (tyVarsOfTypes xis)
+  = return emptyCCan
+  | otherwise
+  = do { let (tyvars, sc_theta, _, _) = classBigSig cls
              sc_theta1 = substTheta (zipTopTvSubst tyvars xis) sc_theta
        ; sc_vars <- zipWithM inst_one sc_theta1 [0..]
        ; mkCanonicals flavor sc_vars }