From 93436263afc077d487937c45a12f38ad841dc9f0 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 17 Oct 2001 13:12:56 +0000 Subject: [PATCH] [project @ 2001-10-17 13:12:56 by simonmar] Use the smart constructor mkNote instead of the dumb constructor (Note) when rebuilding the expression after eta expansion. This is necessary to avoid invalidating some assumptions we make about the output of etaExpand in CorePrep, in particular that there aren't any lambda expressions inside an SCC note. --- ghc/compiler/coreSyn/CoreUtils.lhs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/coreSyn/CoreUtils.lhs b/ghc/compiler/coreSyn/CoreUtils.lhs index 1ca6d37..c8f800f 100644 --- a/ghc/compiler/coreSyn/CoreUtils.lhs +++ b/ghc/compiler/coreSyn/CoreUtils.lhs @@ -804,14 +804,17 @@ eta_expand n us expr ty -- Saturated, so nothing to do = expr - -- Short cut for the case where there already - -- is a lambda; no point in gratuitously adding more eta_expand n us (Note note@(Coerce _ ty) e) _ = Note note (eta_expand n us e ty) + -- Use mkNote so that _scc_s get pushed inside any lambdas that + -- are generated as part of the eta expansion. We rely on this + -- behaviour in CorePrep, when we eta expand an already-prepped RHS. eta_expand n us (Note note e) ty - = Note note (eta_expand n us e ty) + = mkNote note (eta_expand n us e ty) + -- Short cut for the case where there already + -- is a lambda; no point in gratuitously adding more eta_expand n us (Lam v body) ty | isTyVar v = Lam v (eta_expand n us body (applyTy ty (mkTyVarTy v))) -- 1.7.10.4