summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Session.hs
diff options
context:
space:
mode:
authorHaskellMouse <rinat.stryungis@serokell.io>2022-04-27 06:19:45 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-06-06 09:50:00 -0400
commit9ce9ea5071af5c7a5b6fcef11ac6e19c14480901 (patch)
tree7d6113e6e2eef0cefebf4302dda8ff4bec157b73 /compiler/GHC/Driver/Session.hs
parent5a3fdcfd615b502f123bb31f42d22577d44748ac (diff)
downloadhaskell-9ce9ea5071af5c7a5b6fcef11ac6e19c14480901.tar.gz
Deprecate TypeInType extension
This commit fixes #20312 It deprecates "TypeInType" extension according to the following proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0083-no-type-in-type.rst It has been already implemented. The migration strategy: 1. Disable TypeInType 2. Enable both DataKinds and PolyKinds extensions Metric Decrease: T16875
Diffstat (limited to 'compiler/GHC/Driver/Session.hs')
-rw-r--r--compiler/GHC/Driver/Session.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index af4301cce7..627b2c69b3 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -3179,6 +3179,17 @@ deprecatedForExtension lang turn_on
flag | turn_on = lang
| otherwise = "No" ++ lang
+deprecatedForExtensions :: [String] -> TurnOnFlag -> String
+deprecatedForExtensions [] _ = panic "new extension has not been specified"
+deprecatedForExtensions [lang] turn_on = deprecatedForExtension lang turn_on
+deprecatedForExtensions langExts turn_on
+ = "use " ++ xExt flags ++ " instead"
+ where
+ flags | turn_on = langExts
+ | otherwise = ("No" ++) <$> langExts
+
+ xExt fls = intercalate " and " $ (\flag -> "-X" ++ flag) <$> fls
+
useInstead :: String -> String -> TurnOnFlag -> String
useInstead prefix flag turn_on
= "Use " ++ prefix ++ no ++ flag ++ " instead"
@@ -3745,7 +3756,8 @@ xFlagsDeps = [
flagSpec "TransformListComp" LangExt.TransformListComp,
flagSpec "TupleSections" LangExt.TupleSections,
flagSpec "TypeApplications" LangExt.TypeApplications,
- flagSpec "TypeInType" LangExt.TypeInType,
+ depFlagSpec' "TypeInType" LangExt.TypeInType
+ (deprecatedForExtensions ["DataKinds", "PolyKinds"]),
flagSpec "TypeFamilies" LangExt.TypeFamilies,
flagSpec "TypeOperators" LangExt.TypeOperators,
flagSpec "TypeSynonymInstances" LangExt.TypeSynonymInstances,