Rodrigo Mesquita pushed to branch wip/romes/hsmodulename at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • ghc/GHCi/UI.hs
    ... ... @@ -1229,8 +1229,8 @@ getInfoForPrompt = do
    1229 1229
             rev_imports = reverse imports -- rightmost are the most recent
    
    1230 1230
     
    
    1231 1231
             myIdeclName :: ImportDecl GhcPs -> ModuleName
    
    1232
    -        myIdeclName d | Just m <- ideclAs d = unLoc m
    
    1233
    -                      | otherwise           = unLoc (ideclName d)
    
    1232
    +        myIdeclName d | Just m <- ideclAs d = hsModuleName (unLoc m)
    
    1233
    +                      | otherwise           = hsModuleName (unLoc (ideclName d))
    
    1234 1234
     
    
    1235 1235
             modules_names =
    
    1236 1236
                  ['*':(moduleNameString (moduleName m)) | IIModule m <- rev_imports] ++
    
    ... ... @@ -2592,7 +2592,7 @@ keepPackageImports = filterM is_pkg_import
    2592 2592
                     Left _  -> return False
    
    2593 2593
                     Right m -> return $ not (HUG.memberHugUnit (moduleUnit m) hug)
    
    2594 2594
             where
    
    2595
    -          mod_name = unLoc (ideclName d)
    
    2595
    +          mod_name = hsModuleName (unLoc (ideclName d))
    
    2596 2596
     
    
    2597 2597
     {- Note [GHCi and local Preludes]
    
    2598 2598
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ... ... @@ -2976,8 +2976,9 @@ guessCurrentModule cmd = do
    2976 2976
         [] -> throwGhcException $ CmdLineError (':' : cmd ++ ": no current module")
    
    2977 2977
         IIModule m : _ -> pure m
    
    2978 2978
         IIDecl d : _ -> do
    
    2979
    -      pkgqual <- GHC.renameRawPkgQualM (unLoc $ ideclName d) (ideclPkgQual d)
    
    2980
    -      GHC.findQualifiedModule pkgqual (unLoc (ideclName d))
    
    2979
    +      let mod_name = hsModuleName (unLoc (ideclName d))
    
    2980
    +      pkgqual <- GHC.renameRawPkgQualM mod_name (ideclPkgQual d)
    
    2981
    +      GHC.findQualifiedModule pkgqual mod_name
    
    2981 2982
     
    
    2982 2983
     -- without bang, show items in context of their parents and omit children
    
    2983 2984
     -- with bang, show class methods and data constructors separately, and
    
    ... ... @@ -3177,7 +3178,7 @@ checkAdd ii = do
    3177 3178
            | otherwise -> checkInterpretedModule mod >> return ()
    
    3178 3179
     
    
    3179 3180
         IIDecl d -> do
    
    3180
    -       let modname = unLoc (ideclName d)
    
    3181
    +       let modname = hsModuleName (unLoc (ideclName d))
    
    3181 3182
            pkgqual <- GHC.renameRawPkgQualM modname (ideclPkgQual d)
    
    3182 3183
            m <- lookupQualifiedModuleName pkgqual modname
    
    3183 3184
            when safe $ do
    
    ... ... @@ -3257,7 +3258,7 @@ isIIModule _ = False
    3257 3258
     
    
    3258 3259
     iiModuleName :: InteractiveImport -> ModuleName
    
    3259 3260
     iiModuleName (IIModule m) = moduleName m
    
    3260
    -iiModuleName (IIDecl d)   = unLoc (ideclName d)
    
    3261
    +iiModuleName (IIDecl d)   = hsModuleName (unLoc (ideclName d))
    
    3261 3262
     
    
    3262 3263
     preludeModuleName :: ModuleName
    
    3263 3264
     preludeModuleName = GHC.mkModuleName "Prelude"
    

  • ghc/GHCi/UI/Info.hs
    ... ... @@ -127,7 +127,7 @@ findLoc infos span0 string = do
    127 127
     
    
    128 128
         case getSrcSpan name' of
    
    129 129
             UnhelpfulSpan{} -> throwE $ GhciNoLocationInfoForModule
    
    130
    -          (maybe (ModuleName "<unknown>") moduleName (nameModule_maybe name'))
    
    130
    +          (maybe (mkModuleName "<unknown>") moduleName (nameModule_maybe name'))
    
    131 131
             span' -> return (info,name',span')
    
    132 132
     
    
    133 133
     -- | Find any uses of the given identifier in the codebase.
    

  • linters/lint-codes/LintCodes/Static.hs
    ... ... @@ -70,7 +70,7 @@ import GHC.Unit.Finder
    70 70
       ( FindResult(..), ModuleLookupScope(..), findImportedModule )
    
    71 71
     import GHC.Utils.Outputable
    
    72 72
       ( text )
    
    73
    -import Language.Haskell.Syntax.Module.Name
    
    73
    +import GHC.Unit.Module.Name
    
    74 74
       ( mkModuleName )
    
    75 75
     
    
    76 76
     --------------------------------------------------------------------------------
    

  • testsuite/tests/ghc-api/downsweep/IncrementalDownsweep.hs
    ... ... @@ -10,7 +10,7 @@ import System.Environment (getArgs)
    10 10
     import System.Exit (exitFailure)
    
    11 11
     import System.IO (stderr)
    
    12 12
     import System.Directory (removeFile)
    
    13
    -import Language.Haskell.Syntax.Module.Name (moduleNameString)
    
    13
    +import GHC.Unit.Module.Name (moduleNameString)
    
    14 14
     import GHC.Utils.Ppr (Mode (PageMode))
    
    15 15
     import GHC.Utils.Outputable (vcat, defaultSDocContext, printSDocLn, ppr)
    
    16 16
     import GHC.Utils.Logger (getLogger)
    

  • testsuite/tests/profiling/should_run/caller-cc/CallerCcParser.hs
    ... ... @@ -3,7 +3,7 @@
    3 3
     module Main where
    
    4 4
     
    
    5 5
     import GHC.Core.Opt.CallerCC
    
    6
    -import Language.Haskell.Syntax.Module.Name
    
    6
    +import GHC.Unit.Module.Name
    
    7 7
     
    
    8 8
     deriving instance Eq CallerCcFilter
    
    9 9
     deriving instance Show CallerCcFilter