diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2021-01-20 20:33:30 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-02-13 21:28:49 -0500 |
commit | f1362008daabb518b6fcd8079fb89683fb642597 (patch) | |
tree | 171d08636f12373e4a721ed2449f0fe4c60f3d0f /compiler/GHC | |
parent | 448fd22d84a6d8100448861633f7918584bf97e8 (diff) | |
download | haskell-f1362008daabb518b6fcd8079fb89683fb642597.tar.gz |
Always set `safeInferred`, not only when it turns `False`
previously, `safeFlagCheck` would be happy to switch the `safeFlag` to
`False`, but not the other way around. This meant that after
:set -XGeneralizedNewtypeDeriving
:set -XNoGeneralizedNewtypeDeriving
in GHCi all loaded files would be still be infered as unsafe.
This fixes #19243.
This is a corner case, but somewhat relevant once ghci by default starts
with `GeneralizedNewtypeDeriving` on (due to GHC2021).
Diffstat (limited to 'compiler/GHC')
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 7d32e7ad8a..479223af9c 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -1862,10 +1862,9 @@ safeFlagCheck _ dflags | safeLanguageOn dflags = (dflagsUnset, warns) ++ str] safeFlagCheck cmdl dflags = - case (safeInferOn dflags) of - True | safeFlags -> (dflags', warn) - True -> (dflags' { safeInferred = False }, warn) - False -> (dflags', warn) + case safeInferOn dflags of + True -> (dflags' { safeInferred = safeFlags }, warn) + False -> (dflags', warn) where -- dynflags and warn for when -fpackage-trust by itself with no safe |