Fix Trac #5126: generate correct usage info in TH declaration quotes
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 20 Apr 2011 16:15:38 +0000 (17:15 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 20 Apr 2011 16:15:38 +0000 (17:15 +0100)
In RnBinds.rnValBindsRHS I had
      (sig_dus `plusDU` bind_dus)
when it should be
      (bind_dus `plusDU` sig_dus)

So the fix is easy.

compiler/rename/RnBinds.lhs

index 21822a8..df3b12d 100644 (file)
@@ -306,7 +306,10 @@ rnValBindsRHS trim mb_bound_names (ValBindsIn mbinds sigs)
            (anal_binds, anal_dus) -> return (valbind', valbind'_dus)
               where
                 valbind' = ValBindsOut anal_binds sigs'
            (anal_binds, anal_dus) -> return (valbind', valbind'_dus)
               where
                 valbind' = ValBindsOut anal_binds sigs'
-                valbind'_dus = usesOnly (hsSigsFVs sigs') `plusDU` anal_dus
+                valbind'_dus = anal_dus `plusDU` usesOnly (hsSigsFVs sigs')
+                              -- Put the sig uses *after* the bindings
+                              -- so that the binders are removed from 
+                              -- the uses in the sigs
        }
 
 rnValBindsRHS _ _ b = pprPanic "rnValBindsRHS" (ppr b)
        }
 
 rnValBindsRHS _ _ b = pprPanic "rnValBindsRHS" (ppr b)