Skip to content

Commit

Permalink
FindImports: ThisPkg means some home unit, not "this" unit (#4284)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Peyton Jones <[email protected]>
  • Loading branch information
wz1000 and michaelpj authored Jun 9, 2024
1 parent 52c953c commit 026d0ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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

0 comments on commit 026d0ce

Please sign in to comment.