summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore/Quote.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/HsToCore/Quote.hs')
-rw-r--r--compiler/GHC/HsToCore/Quote.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs
index 767914127a..42e0baca5e 100644
--- a/compiler/GHC/HsToCore/Quote.hs
+++ b/compiler/GHC/HsToCore/Quote.hs
@@ -848,11 +848,14 @@ repAnnD (L loc (HsAnnotation _ _ ann_prov (L _ exp)))
; return (loc, dec) }
repAnnProv :: AnnProvenance Name -> MetaM (Core TH.AnnTarget)
-repAnnProv (ValueAnnProvenance (L _ n))
- = do { MkC n' <- lift $ globalVar n -- ANNs are allowed only at top-level
+repAnnProv (ValueAnnProvenance n)
+ = do { -- An ANN references an identifier bound elsewhere in the module, so
+ -- we must look it up using lookupLOcc (#19377).
+ -- Similarly for TypeAnnProvenance (`ANN type`) below.
+ MkC n' <- lookupLOcc n
; rep2_nw valueAnnotationName [ n' ] }
-repAnnProv (TypeAnnProvenance (L _ n))
- = do { MkC n' <- lift $ globalVar n
+repAnnProv (TypeAnnProvenance n)
+ = do { MkC n' <- lookupLOcc n
; rep2_nw typeAnnotationName [ n' ] }
repAnnProv ModuleAnnProvenance
= rep2_nw moduleAnnotationName []