diff options
-rw-r--r-- | compiler/GHC/Hs/Binds.hs | 7 | ||||
-rw-r--r-- | compiler/GHC/Types/Basic.hs | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index 3a22863537..686d9e6b25 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -724,8 +724,11 @@ ppr_sig (SpecSig _ var ty inl@(InlinePragma { inl_inline = spec })) NoUserInlinePrag -> "{-# " ++ extractSpecPragName (inl_src inl) _ -> "{-# " ++ extractSpecPragName (inl_src inl) ++ "_INLINE" ppr_sig (InlineSig _ var inl) - = pragSrcBrackets (inlinePragmaSource inl) "{-# INLINE" (pprInline inl - <+> pprPrefixOcc (unLoc var)) + = ppr_pfx <+> pprInline inl <+> pprPrefixOcc (unLoc var) <+> text "#-}" + where + ppr_pfx = case inlinePragmaSource inl of + SourceText src -> text src + NoSourceText -> text "{-#" <+> inlinePragmaName (inl_inline inl) ppr_sig (SpecInstSig _ src ty) = pragSrcBrackets src "{-# pragma" (text "instance" <+> ppr ty) ppr_sig (MinimalSig _ src bf) diff --git a/compiler/GHC/Types/Basic.hs b/compiler/GHC/Types/Basic.hs index 7ef2ff6446..a2decc2ba4 100644 --- a/compiler/GHC/Types/Basic.hs +++ b/compiler/GHC/Types/Basic.hs @@ -1769,9 +1769,11 @@ inlinePragmaName (NoInline _) = text "NOINLINE" inlinePragmaName (Opaque _) = text "OPAQUE" inlinePragmaName NoUserInlinePrag = empty +-- | Pretty-print without displaying the user-specified 'InlineSpec'. pprInline :: InlinePragma -> SDoc pprInline = pprInline' True +-- | Pretty-print including the user-specified 'InlineSpec'. pprInlineDebug :: InlinePragma -> SDoc pprInlineDebug = pprInline' False |