X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FdeSugar%2FDsBinds.lhs;h=815c0d1cfb2222319b65e8e49b185cedd4b1ba26;hb=bf902b277afa1feff586f7d96178b59be2cfcfe2;hp=57c74825960872c104c57959e481ae48d6e58b33;hpb=d93785d99261a433075dcbac8c388730a4dec64f;p=ghc-hetmet.git diff --git a/compiler/deSugar/DsBinds.lhs b/compiler/deSugar/DsBinds.lhs index 57c7482..815c0d1 100644 --- a/compiler/deSugar/DsBinds.lhs +++ b/compiler/deSugar/DsBinds.lhs @@ -526,13 +526,14 @@ dsSpec mb_poly_rhs (L loc (SpecPrag poly_id spec_co spec_inl)) where is_local_id = isJust mb_poly_rhs poly_rhs | Just rhs <- mb_poly_rhs - = rhs - | Just unfolding <- maybeUnfoldingTemplate (idUnfolding poly_id) - = unfolding + = rhs -- Local Id; this is its rhs + | Just unfolding <- maybeUnfoldingTemplate (realIdUnfolding poly_id) + = unfolding -- Imported Id; this is its unfolding + -- Use realIdUnfolding so we get the unfolding + -- even when it is a loop breaker. + -- We want to specialise recursive functions! | otherwise = pprPanic "dsImpSpecs" (ppr poly_id) - -- In the Nothing case the specialisation is for an imported Id - -- whose unfolding gives the RHS to be specialised - -- The type checker has checked that it has an unfolding + -- The type checker has checked that it *has* an unfolding specUnfolding :: (CoreExpr -> CoreExpr) -> Type -> Unfolding -> DsM (Unfolding, OrdList (Id,CoreExpr))