diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2021-02-15 10:52:42 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2021-02-15 10:55:54 -0500 |
commit | bd54c17600f763be34622da9f53f49213724f0ce (patch) | |
tree | 420f982adbc723aa6cb5e996576d935dd50dbf8c /testsuite/tests/th/T19377.hs | |
parent | b9fe4cd5ea843e95a333520e2e6036dd83852f5e (diff) | |
download | haskell-bd54c17600f763be34622da9f53f49213724f0ce.tar.gz |
Fix #19377 by using lookupLOcc when desugaring TH-quoted ANNswip/T19377
Previously, the desugarer was looking up names referenced in TH-quoted `ANN`s
by using `globalVar`, which would allocate a fresh TH `Name`. In effect, this
would prevent quoted `ANN`s from ever referencing the correct identifier
`Name`, leading to #19377. The fix is simple: instead of `globalVar`, use
`lookupLOcc`, which properly looks up the name of the in-scope identifier.
Fixes #19377.
Diffstat (limited to 'testsuite/tests/th/T19377.hs')
-rw-r--r-- | testsuite/tests/th/T19377.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/th/T19377.hs b/testsuite/tests/th/T19377.hs new file mode 100644 index 0000000000..e27149ccfe --- /dev/null +++ b/testsuite/tests/th/T19377.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TemplateHaskell #-} +module T19377 where + +$([d| x :: Int + x = 42 + {-# ANN x "blah" #-} + + data Y + {-# ANN type Y "yargh" #-} + |]) |