diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-07-05 14:03:25 -0400 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2021-07-25 22:45:36 +0000 |
commit | 03fd6122ed2f28f64558acbebdc2b376fc776933 (patch) | |
tree | 1a8b1f2884136df6626995900e4fcfa0c9b3287b | |
parent | 1832676aba0a5d75ac934a62eff55e35f95587d5 (diff) | |
download | haskell-wip/warn-unqualified.tar.gz |
rename: Avoid unnecessary map lookupwip/warn-unqualified
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.hs | 4 |
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" |