diff options
-rw-r--r-- | compiler/GHC/Stg/Debug.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/Stg/Debug.hs b/compiler/GHC/Stg/Debug.hs index 46206d786e..30481baebf 100644 --- a/compiler/GHC/Stg/Debug.hs +++ b/compiler/GHC/Stg/Debug.hs @@ -62,7 +62,14 @@ collectStgBind (StgRec pairs) = do collectStgRhs :: Id -> StgRhs -> M StgRhs collectStgRhs bndr (StgRhsClosure ext cc us bs e)= do - e' <- collectExpr e + let + name = idName bndr + -- If the name has a span, use that initially as the source position in-case + -- we don't get anything better. + with_span = case nameSrcSpan name of + RealSrcSpan pos _ -> withSpan (pos, occNameString (getOccName name)) + _ -> id + e' <- with_span $ collectExpr e recordInfo bndr e' return $ StgRhsClosure ext cc us bs e' collectStgRhs _bndr (StgRhsCon cc dc _mn ticks args) = do |