[project @ 2003-12-17 11:43:13 by simonpj]
authorsimonpj <unknown>
Wed, 17 Dec 2003 11:43:13 +0000 (11:43 +0000)
committersimonpj <unknown>
Wed, 17 Dec 2003 11:43:13 +0000 (11:43 +0000)
---------------------------------
  Gate in a few more instance decls
  ---------------------------------

When we have
instance T a where...

we need to suck in the instance decl rather more aggressively than we
were.  (A case I hadn't thought of because it only happens with
undecideable instances.)

ghc/compiler/iface/TcIface.lhs

index 51bf028..39eadfb 100644 (file)
@@ -529,8 +529,9 @@ selectInsts pool@(Pool insts n_in n_out) cls tycons
 
        -- Reverses the gated decls, but that doesn't matter
     choose2 (gis, decls) (gates, decl)
 
        -- Reverses the gated decls, but that doesn't matter
     choose2 (gis, decls) (gates, decl)
-       | any (`elem` tycons) gates = (gis,                decl:decls)
-       | otherwise                 = ((gates,decl) : gis, decls)
+       |  null gates   -- Happens when we have 'instance T a where ...'
+        || any (`elem` tycons) gates = (gis,              decl:decls)
+       | otherwise                  = ((gates,decl) : gis, decls)
 \end{code}
 
 %************************************************************************
 \end{code}
 
 %************************************************************************