[Git][ghc/ghc][master] Fix TH name lookup for symbolic tycons (#23525)
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Sun Jun 18 06:51:31 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
89bb8ad8 by Ryan Hendrickson at 2023-06-18T02:51:14-04:00
Fix TH name lookup for symbolic tycons (#23525)
- - - - -
3 changed files:
- compiler/GHC/ThToHs.hs
- + testsuite/tests/th/T23525.hs
- testsuite/tests/th/all.T
Changes:
=====================================
compiler/GHC/ThToHs.hs
=====================================
@@ -2177,9 +2177,11 @@ thRdrNameGuesses (TH.Name occ flavour)
where
-- guessed_ns are the name spaces guessed from looking at the TH name
guessed_nss
- | isLexCon (mkFastString occ_str) = [OccName.tcName, OccName.dataName]
- | otherwise = [OccName.varName, OccName.tvName]
+ | isLexCon occ_txt = [OccName.tcName, OccName.dataName]
+ | isLexVarSym occ_txt = [OccName.tcName, OccName.varName] -- #23525
+ | otherwise = [OccName.varName, OccName.tvName]
occ_str = TH.occString occ
+ occ_txt = mkFastString occ_str
-- The packing and unpacking is rather turgid :-(
mk_occ :: OccName.NameSpace -> String -> OccName.OccName
=====================================
testsuite/tests/th/T23525.hs
=====================================
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module T23525 where
+
+import Language.Haskell.TH
+
+$(sequence [withDecDoc "doc string" $ tySynD (mkName ">-:") [] [t| () |]])
=====================================
testsuite/tests/th/all.T
=====================================
@@ -576,3 +576,4 @@ test('T21050', normal, compile_fail, [''])
test('T22559a', normal, compile_fail, [''])
test('T22559b', normal, compile_fail, [''])
test('T22559c', normal, compile_fail, [''])
+test('T23525', normal, compile, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/89bb8ad8b5fa56b83fe80dd6d7147ad81ae4e74d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/89bb8ad8b5fa56b83fe80dd6d7147ad81ae4e74d
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230618/31b02f6e/attachment-0001.html>
More information about the ghc-commits
mailing list