Worker Wrapper should duplicate source notes onto the wrapper
Suppose you have a definition
toIfaceTyCon :: TyCon -> IfaceTyCon
then if you compile with -g3
to enable source notes then the desugared version might look like
toIfaceTyCon = \w -> <tick> body
Worker wrapper then applies to toIfaceTyCon
, and performs the WW split, at which point the tick is only moved into the worker.
$wToIfaceTyCon :: TyCon -> (# IfExtName, IfaceTyConInfo #)
$wToIfaceTyCon = \tc -> <TICK> body
toIfaceTyCon
= \ (w_saGx :: TyCon) ->
case GHC.CoreToIface.$wtoIfaceTyCon w_saGx of
{ (# ww1_saJK, ww2_saJL #) ->
GHC.Iface.Type.IfaceTyCon ww1_saJK ww2_saJL
}
Now there is a source of allocation, IfaceTyCon
, which won't get a proper entry in the IPE map because there isn't a surrounding tick. It would be better if the tick was copied onto the worker as well so the allocation could be tracked back to the definition of toIfaceTyCon.
$wToIfaceTyCon :: TyCon -> (# IfExtName, IfaceTyConInfo #)
$wToIfaceTyCon = \tc -> <TICK> body
toIfaceTyCon
= \ (w_saGx :: TyCon) -> <TICK>
case GHC.CoreToIface.$wtoIfaceTyCon w_saGx of
{ (# ww1_saJK, ww2_saJL #) ->
GHC.Iface.Type.IfaceTyCon ww1_saJK ww2_saJL
}