google / ghc-source-gen

Library for generating Haskell source files and code fragments.
BSD 3-Clause "New" or "Revised" License
91 stars 29 forks source link

collectModuleName breaks in the presence of MagicHash #80

Open isovector opened 3 years ago

isovector commented 3 years ago

Consider the perfectly reasonable name under -XMagicHash: Jn#. This causes an error:

Unable to parse RdrNameStr: "Jn#"
CallStack (from HasCallStack):
  error, called at src/GHC/SourceGen/Name/Internal.hs:106:10 in ghc-source-gen-0.4.0.0-5bO8D09FGq6LIxEy1df7VD:GHC.SourceGen.Name.Internal
judah commented 3 years ago

Thanks for the report. This should be an straightforward fix for the IsString instance in GHC.SourceGen.Name.Internal. Would you like to send a patch?