diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2023-04-01 10:20:35 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-04-04 11:09:51 -0400 |
commit | 071139c30ab95e6a292bec8ae0dcb6bf2be6308d (patch) | |
tree | 07d781797008624e1383dc088e659f2f55dda570 /compiler | |
parent | eed0d9307b3f48b6a2e45dbb246610cf4ab73896 (diff) | |
download | haskell-071139c30ab95e6a292bec8ae0dcb6bf2be6308d.tar.gz |
Make INLINE pragmas for pattern synonyms work with TH
Previously, the code for converting `INLINE <name>` pragmas from TH splices
used `vNameN`, which assumed that `<name>` must live in the variable namespace.
Pattern synonyms, on the other hand, live in the constructor namespace. I've
fixed the issue by switching to `vcNameN` instead, which works for both the
variable and constructor namespaces.
Fixes #23203.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/ThToHs.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index 991674db34..724f15f602 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -851,7 +851,10 @@ cvt_conv TH.JavaScript = JavaScriptCallConv cvtPragmaD :: Pragma -> CvtM (Maybe (LHsDecl GhcPs)) cvtPragmaD (InlineP nm inline rm phases) - = do { nm' <- vNameN nm + = do { -- NB: Use vcNameN here, which works for both the variable namespace + -- (e.g., `INLINE`d functions) and the constructor namespace + -- (e.g., `INLINE`d pattern synonyms, cf. #23203) + nm' <- vcNameN nm ; let dflt = dfltActivation inline ; let src TH.NoInline = "{-# NOINLINE" src TH.Inline = "{-# INLINE" |