diff options
author | Winston Hartnett <winstonhartnett@gmail.com> | 2022-06-16 19:24:43 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-06-20 12:32:23 -0400 |
commit | 262a9f93e84ffacd6540e72e941e3cc69cf87807 (patch) | |
tree | c9badc3bcf75c07bab6b797796f153a61d40ec5e | |
parent | e4e44d8d54518fa88318e9f5ebe109839f6c180a (diff) | |
download | haskell-262a9f93e84ffacd6540e72e941e3cc69cf87807.tar.gz |
Make Outputable instance for InlineSig print the InlineSpec
Fix ghc/ghc#21739
Squash fix ghc/ghc#21739
-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 |