diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2021-01-20 20:33:30 +0100 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2021-01-20 20:34:33 +0100 |
commit | ecfb1eb2d178f0a478df01c46309571287c246af (patch) | |
tree | e2e08463f452343410beec4c2f824be66562c375 /compiler/GHC/Driver/Session.hs | |
parent | 9cc50a0fce206cfecb973c9b061a2912b2361d3e (diff) | |
download | haskell-wip/T19243.tar.gz |
Always set `safeInferred`, not only when it turns `False`wip/T19243
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/Driver/Session.hs')
-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 8e92fc974f..0c09ce7ec2 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -2003,10 +2003,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 |