@@ -637,24 +637,30 @@ hoistExpr var t = do
637637 -- See Note [Dependency tracking]
638638 modifyCurDeps (Set. insert lexName)
639639 maybeDef <- PIR. lookupTerm lexName
640- let addSpan = case getVarSourceSpan var of
640+ let varSpan = getVarSourceSpan var
641+ addSpan = case varSpan of
641642 Nothing -> id
642643 Just src -> fmap . fmap . addSrcSpan $ src ^. srcSpanIso
644+ varSpanMsg = case varSpan of
645+ Nothing -> " "
646+ Just src -> " , located at" GHC. <+> GHC. ppr src
643647 case maybeDef of
644648 Just term -> pure term
645649 -- See Note [Dependency tracking]
646- Nothing -> withCurDef lexName . traceCompilation 1 (" Compiling definition of:" GHC. <+> GHC. ppr var) $ do
647- var' <- compileVarFresh ann var
648- -- See Note [Occurrences of recursive names]
649- PIR. defineTerm
650- lexName
651- (PIR. Def var' (PIR. mkVar var', PIR. Strict ))
652- mempty
653-
654- t' <- maybeProfileRhs var var' =<< addSpan (compileExpr t)
655- -- See Note [Non-strict let-bindings]
656- PIR. modifyTermDef lexName (const $ PIR. Def var' (t', PIR. NonStrict ))
657- pure $ PIR. mkVar var'
650+ Nothing -> withCurDef lexName
651+ . traceCompilation 1 (" Compiling definition of:" GHC. <+> GHC. ppr var GHC. <> varSpanMsg)
652+ $ do
653+ var' <- compileVarFresh ann var
654+ -- See Note [Occurrences of recursive names]
655+ PIR. defineTerm
656+ lexName
657+ (PIR. Def var' (PIR. mkVar var', PIR. Strict ))
658+ mempty
659+
660+ t' <- maybeProfileRhs var var' =<< addSpan (compileExpr t)
661+ -- See Note [Non-strict let-bindings]
662+ PIR. modifyTermDef lexName (const $ PIR. Def var' (t', PIR. NonStrict ))
663+ pure $ PIR. mkVar var'
658664
659665-- 'GHC.Var' in argument is only for extracting srcspan and accurate name.
660666maybeProfileRhs
0 commit comments