Simon Hengel pushed to branch wip/sol/reexported-error-message at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • compiler/GHC/Unit/State.hs
    ... ... @@ -1969,24 +1969,28 @@ lookupModuleWithSuggestions' pkgs mod_map name mb_pn
    1969 1969
         classify (hidden_pkg, hidden_mod, unusable, exposed) (m, origin0) =
    
    1970 1970
           let origin = filterOrigin mb_pn (mod_unit m) origin0
    
    1971 1971
               x = (m, origin)
    
    1972
    -
    
    1973
    -          originUnit :: [UnitInfo] -> [UnitInfo]
    
    1974
    -          originUnit
    
    1975
    -            | moduleName m == name, Just pkg <- lookupUnit pkgs (moduleUnit m) = (pkg :)
    
    1976
    -            | otherwise = id
    
    1977
    -
    
    1978 1972
           in case origin of
    
    1979 1973
               ModHidden
    
    1980 1974
                 -> (hidden_pkg, x:hidden_mod, unusable, exposed)
    
    1981 1975
               ModUnusable _
    
    1982 1976
                 -> (hidden_pkg, hidden_mod, x:unusable, exposed)
    
    1983
    -          ModOrigin _ _ reexports _
    
    1977
    +          ModOrigin { fromOrigUnit, fromHiddenReexport }
    
    1984 1978
                 | originEmpty origin
    
    1985 1979
                 -> (hidden_pkg,   hidden_mod, unusable, exposed)
    
    1986 1980
                 | originVisible origin
    
    1987 1981
                 -> (hidden_pkg, hidden_mod, unusable, x:exposed)
    
    1988 1982
                 | otherwise
    
    1989
    -            -> (reexports ++ originUnit hidden_pkg, hidden_mod, unusable, exposed)
    
    1983
    +            -> (fromHiddenReexport ++ maybe id (:) origUnit hidden_pkg, hidden_mod, unusable, exposed)
    
    1984
    +            where
    
    1985
    +              origUnit :: Maybe UnitInfo
    
    1986
    +              origUnit
    
    1987
    +                | origAvailableUnderSameName = lookupUnit pkgs (moduleUnit m)
    
    1988
    +                | otherwise = Nothing
    
    1989
    +
    
    1990
    +              origAvailableUnderSameName :: Bool
    
    1991
    +              origAvailableUnderSameName = case fromOrigUnit of
    
    1992
    +                Nothing -> False
    
    1993
    +                Just _ -> True
    
    1990 1994
     
    
    1991 1995
         unit_lookup p = lookupUnit pkgs p `orElse` pprPanic "lookupModuleWithSuggestions" (ppr p <+> ppr name)
    
    1992 1996
         mod_unit = unit_lookup . moduleUnit
    

  • testsuite/tests/package/ImportReexport.hs
    1 1
     module ImportReexport where
    
    2
    -import GHC.Types -- reexported by ghc-prim from ghc-internal
    2
    +import GHC.Types -- reexported and renamed by ghc-prim from ghc-internal
    
    3
    +import GHC.Platform.ArchOS -- reexported by by ghc and ghc-boot + provided by ghc-platform

  • testsuite/tests/package/ImportReexport.stderr
    ... ... @@ -3,3 +3,10 @@ ImportReexport.hs:2:1: error: [GHC-87110]
    3 3
         It is a member of the hidden package ‘ghc-prim-0.14.0’.
    
    4 4
         Use -v to see a list of the files searched for.
    
    5 5
     
    
    6
    +ImportReexport.hs:3:1: error: [GHC-87110]
    
    7
    +    Could not load module ‘GHC.Platform.ArchOS’.
    
    8
    +    It is a member of the hidden package ‘ghc-10.1’.
    
    9
    +    It is a member of the hidden package ‘ghc-boot-10.1’.
    
    10
    +    It is a member of the hidden package ‘ghc-platform-0.1.0.0’.
    
    11
    +    Use -v to see a list of the files searched for.
    
    12
    +