diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-12-21 10:37:09 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-12-23 10:22:35 -0500 |
commit | f59c34b8e4322beca33e38bbb9a1df8acdf62011 (patch) | |
tree | 292d4f8c07c3ad70dbd4d1285567c863cd3d6921 /compiler/GHC/Parser | |
parent | f0ec06c76ccd6797d42736fd423adbbb238723b4 (diff) | |
download | haskell-f59c34b8e4322beca33e38bbb9a1df8acdf62011.tar.gz |
Support package qualifier in Prelude import
Fix #19082, #17045
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r-- | compiler/GHC/Parser/Header.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs index 4e2c297bea..5abb0497d4 100644 --- a/compiler/GHC/Parser/Header.hs +++ b/compiler/GHC/Parser/Header.hs @@ -129,11 +129,15 @@ mkPrelImports this_mod loc implicit_prelude import_decls = [] | otherwise = [preludeImportDecl] where - explicit_prelude_import - = notNull [ () | L _ (ImportDecl { ideclName = mod - , ideclPkgQual = Nothing }) - <- import_decls - , unLoc mod == pRELUDE_NAME ] + explicit_prelude_import = any is_prelude_import import_decls + + is_prelude_import (L _ decl) = + unLoc (ideclName decl) == pRELUDE_NAME + -- allow explicit "base" package qualifier (#19082, #17045) + && case ideclPkgQual decl of + Nothing -> True + Just b -> sl_fs b == unitIdFS baseUnitId + preludeImportDecl :: LImportDecl GhcPs preludeImportDecl |