summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-07-05 14:03:25 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-27 04:47:16 -0400
commit51ff03655850cf73a0bfd0ff9d974b184d9aac17 (patch)
treed37fdc916ff171ce24a4c1fb2f39ef1bd4a78569
parent0462750fa475537b817bdcec1a94d924a3489d36 (diff)
downloadhaskell-51ff03655850cf73a0bfd0ff9d974b184d9aac17.tar.gz
rename: Avoid unnecessary map lookup
Previously the -Wcompat-unqualified-imports warning would first check whether an import is of a covered module, incurring an map lookup, before checking the simple boolean predicate of whether it is qualified. This is more expensive than strictly necessary (although at the moment the warning is unused, so this will make little difference).
-rw-r--r--compiler/GHC/Rename/Names.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs
index a66430d7ba..2a27773647 100644
--- a/compiler/GHC/Rename/Names.hs
+++ b/compiler/GHC/Rename/Names.hs
@@ -571,9 +571,9 @@ warnUnqualifiedImport decl iface =
Just (False, _) -> True
_ -> False
bad_import =
- mod `elemModuleSet` qualifiedMods
- && not is_qual
+ not is_qual
&& not has_import_list
+ && mod `elemModuleSet` qualifiedMods
warning = vcat
[ text "To ensure compatibility with future core libraries changes"