summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2010-05-06 16:41:35 +0000
committersimonpj@microsoft.com <unknown>2010-05-06 16:41:35 +0000
commitbc115352a6211fa8814eb1b584fe5284bf57ca00 (patch)
tree39d5c9a6321d5a35efb0759b48a77eb3b744e077
parent241b0013560b3ee5a54f35672417dac330b938e0 (diff)
downloadhaskell-bc115352a6211fa8814eb1b584fe5284bf57ca00.tar.gz
Find the correct external ids when there's a wrapper
We were failing to externalise the wrapper id for a function that had one.
-rw-r--r--compiler/main/TidyPgm.lhs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/main/TidyPgm.lhs b/compiler/main/TidyPgm.lhs
index 98ab1d9314..0245978491 100644
--- a/compiler/main/TidyPgm.lhs
+++ b/compiler/main/TidyPgm.lhs
@@ -709,10 +709,17 @@ addExternal expose_all id = (new_needed_ids, show_unfold)
mb_unfold_ids :: Maybe (IdSet, [Id]) -- Nothing => don't unfold
mb_unfold_ids = case unfoldingInfo idinfo of
CoreUnfolding { uf_tmpl = unf_rhs, uf_src = src, uf_guidance = guide }
- | show_unfolding src guide
- -> Just (exprFvsInOrder unf_rhs)
+ | show_unfolding src guide
+ -> Just (unf_ext_ids src unf_rhs)
DFunUnfolding _ ops -> Just (exprsFvsInOrder ops)
_ -> Nothing
+ where
+ unf_ext_ids (InlineWrapper v) _ = (unitVarSet v, [v])
+ unf_ext_ids _ unf_rhs = exprFvsInOrder unf_rhs
+ -- For a wrapper, externalise the wrapper id rather than the
+ -- fvs of the rhs. The two usually come down to the same thing
+ -- but I've seen cases where we had a wrapper id $w but a
+ -- rhs where $w had been inlined; see Trac #3922
show_unfolding unf_source unf_guidance
= expose_all -- 'expose_all' says to expose all