Permalink
Browse files

fix the home_imps filter to allow for 'import "this" <module>'

In the PackageImports extension, import "this" means "import from the
current package".
  • Loading branch information...
1 parent 3679b28 commit 436a5fdbe0c9a466569abf1d501a6018aaa3e49e @simonmar simonmar committed Jun 21, 2010
Showing with 4 additions and 1 deletion.
  1. +4 −1 compiler/main/GHC.hs
View
@@ -2016,7 +2016,10 @@ msDeps s =
++ [ (m,False) | m <- ms_home_imps s ]
home_imps :: [Located (ImportDecl RdrName)] -> [Located ModuleName]
-home_imps imps = [ ideclName i | L _ i <- imps, isNothing (ideclPkgQual i) ]
+home_imps imps = [ ideclName i | L _ i <- imps, isLocal (ideclPkgQual i) ]
+ where isLocal Nothing = True
+ isLocal (Just pkg) | pkg == fsLit "this" = True -- "this" is special
+ isLocal _ = False
ms_home_allimps :: ModSummary -> [ModuleName]
ms_home_allimps ms = map unLoc (ms_home_srcimps ms ++ ms_home_imps ms)

0 comments on commit 436a5fd

Please sign in to comment.