Commit b72478f4 authored by Edward Z. Yang's avatar Edward Z. Yang

Don't offer hidden modules for autocomplete.

It was annoying to test GHCi directly, so I added a ghc-api unit test
of the function instead.
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 65f887e1
......@@ -1304,7 +1304,8 @@ lookupModuleWithSuggestions dflags m mb_pn
listVisibleModuleNames :: DynFlags -> [ModuleName]
listVisibleModuleNames dflags =
Map.keys (moduleToPkgConfAll (pkgState dflags))
map fst (filter visible (Map.toList (moduleToPkgConfAll (pkgState dflags))))
where visible (_, ms) = any originVisible (Map.elems ms)
-- | Find all the 'PackageConfig' in both the preload packages from 'DynFlags' and corresponding to the list of
-- 'PackageConfig's
......
......@@ -688,6 +688,7 @@ mk/ghcconfig_*_inplace_bin_ghc-stage2.exe.mk
/tests/ghc-api/T7478/T7478
/tests/ghc-api/T8628
/tests/ghc-api/T8639_api
/tests/ghc-api/T9595
/tests/ghc-api/apirecomp001/myghc
/tests/ghc-api/dynCompileExpr/dynCompileExpr
/tests/ghc-api/ghcApi
......
module Main where
import GHC
import Packages
import GhcMonad
import Outputable
import System.Environment
import DynFlags
import Module
main =
do [libdir] <- getArgs
_ <- runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags dflags
dflags <- getSessionDynFlags
liftIO $ print (mkModuleName "Outputable" `elem` listVisibleModuleNames dflags)
_ <- runGhc (Just libdir) $ do
dflags <- getSessionDynFlags
setSessionDynFlags (dflags { packageFlags = [ExposePackage (PackageArg "ghc") Nothing]})
dflags <- getSessionDynFlags
liftIO $ print (mkModuleName "Outputable" `elem` listVisibleModuleNames dflags)
return ()
......@@ -8,3 +8,4 @@ test('T8639_api', normal,
test('T8628', normal,
run_command,
['$MAKE -s --no-print-directory T8628'])
test('T9595', extra_run_opts('"' + config.libdir + '"'), compile_and_run, ['-package ghc'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment