Parsing package flags doesn't handle module names containing quotes correctly
Summary
When using -package-id
, specifying module names that contain '
causes GHC to give a Can't parse package flag
error.
Steps to reproduce
- run
ghc -package-id "pkg (Mod' as Mod)"
- This prints
<command line>: Can't parse package flag: pkg (Mod' as Mod)
Expected behavior
Since Mod'
is a valid module name, there should be no parsing errors.
Environment
- GHC version used: 9.8.2 and 9.11.20240426 (the current git version)
I think this stems from parseModuleName
in compiler/Language/Haskell/Syntax/Module/Name.hs
where the special characters _
and .
are listed but '
isn't.
As far as I can tell, editing that string literal fixes the error.