summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser/PostProcess.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Parser/PostProcess.hs')
-rw-r--r--compiler/GHC/Parser/PostProcess.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs
index 444471abca..e6daea8fe8 100644
--- a/compiler/GHC/Parser/PostProcess.hs
+++ b/compiler/GHC/Parser/PostProcess.hs
@@ -30,6 +30,7 @@ module GHC.Parser.PostProcess (
mkTyFamInst,
mkFamDecl,
mkInlinePragma,
+ mkOpaquePragma,
mkPatSynMatchGroup,
mkRecConstrOrUpdate,
mkTyClD, mkInstD,
@@ -2559,8 +2560,22 @@ mkInlinePragma src (inl, match_info) mb_act
Nothing -> -- No phase specified
case inl of
NoInline _ -> NeverActive
+ Opaque _ -> NeverActive
_other -> AlwaysActive
+mkOpaquePragma :: SourceText -> InlinePragma
+mkOpaquePragma src
+ = InlinePragma { inl_src = src
+ , inl_inline = Opaque src
+ , inl_sat = Nothing
+ -- By marking the OPAQUE pragma NeverActive we stop
+ -- (constructor) specialisation on OPAQUE things.
+ --
+ -- See Note [OPAQUE pragma]
+ , inl_act = NeverActive
+ , inl_rule = FunLike
+ }
+
-----------------------------------------------------------------------------
-- utilities for foreign declarations