Skip to content

FindImports: ThisPkg means some home unit, not "this" unit #4284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ghcide/src/Development/IDE/Import/FindImports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ locateModule
-> m (Either [FileDiagnostic] Import)
locateModule env comp_info exts targetFor modName mbPkgName isSource = do
case mbPkgName of
-- "this" means that we should only look in the current package
#if MIN_VERSION_ghc(9,3,0)
ThisPkg _ -> do
-- 'ThisPkg' just means some home module, not the current unit
ThisPkg uid
| Just (dirs, reexports) <- lookup uid import_paths
-> lookupLocal uid dirs reexports
| otherwise -> return $ Left $ notFoundErr env modName $ LookupNotFound []
#else
-- "this" means that we should only look in the current package
Just "this" -> do
#endif
lookupLocal (homeUnitId_ dflags) (importPaths dflags) S.empty
#endif
-- if a package name is given we only go look for a package
#if MIN_VERSION_ghc(9,3,0)
OtherPkg uid
Expand Down
1 change: 1 addition & 0 deletions ghcide/test/data/multi-unit/b-1.0.0-inplace
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ a-1.0.0-inplace
-package
base
-XHaskell98
-XPackageImports
B
2 changes: 1 addition & 1 deletion ghcide/test/data/multi-unit/b/B.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module B(module B) where
import A
import "a" A
qux = foo
Loading