summaryrefslogtreecommitdiff
path: root/compiler/GHC/Rename/Utils.hs
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-11-05 00:47:32 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-12 21:22:03 -0500
commitdfc4093ccb7c4b7402830ab7c715b55d90980af1 (patch)
tree7cd92eafd556c01b35d4298597f364dfbabbe25b /compiler/GHC/Rename/Utils.hs
parentca90ffa321a31842a32be1b5b6e26743cd677ec5 (diff)
downloadhaskell-dfc4093ccb7c4b7402830ab7c715b55d90980af1.tar.gz
Implement -Wforall-identifier (#20609)
In accordance with GHC Proposal #281 "Visible forall in types of terms": For three releases before this change takes place, include a new warning -Wforall-identifier in -Wdefault. This warning will be triggered at definition sites (but not use sites) of forall as an identifier. Updates the haddock submodule.
Diffstat (limited to 'compiler/GHC/Rename/Utils.hs')
-rw-r--r--compiler/GHC/Rename/Utils.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/GHC/Rename/Utils.hs b/compiler/GHC/Rename/Utils.hs
index fc27dac004..4041b0b6c8 100644
--- a/compiler/GHC/Rename/Utils.hs
+++ b/compiler/GHC/Rename/Utils.hs
@@ -15,6 +15,7 @@ module GHC.Rename.Utils (
addFvRn, mapFvRn, mapMaybeFvRn,
warnUnusedMatches, warnUnusedTypePatterns,
warnUnusedTopBinds, warnUnusedLocalBinds,
+ warnForallIdentifier,
checkUnusedRecordWildcard,
mkFieldEnv,
unknownSubordinateErr, badQualBndrErr, typeAppErr,
@@ -426,6 +427,13 @@ check_unused flag bound_names used_names
= whenWOptM flag (warnUnused flag (filterOut (`elemNameSet` used_names)
bound_names))
+warnForallIdentifier :: LocatedN RdrName -> RnM ()
+warnForallIdentifier (L l rdr_name@(Unqual occ))
+ | isKw (fsLit "forall") || isKw (fsLit "∀")
+ = addDiagnosticAt (locA l) (TcRnForallIdentifier rdr_name)
+ where isKw = (occNameFS occ ==)
+warnForallIdentifier _ = return ()
+
-------------------------
-- Helpers
warnUnusedGREs :: [GlobalRdrElt] -> RnM ()