Skip to content

Commit

Permalink
Revert the change since it has been taken care of in haskell#738
Browse files Browse the repository at this point in the history
  • Loading branch information
zliu41 committed Sep 3, 2020
1 parent 15948ac commit 20e4ede
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -205,32 +205,26 @@ generateByteCode hscEnv deps tmr guts =
let linkable = LM (ms_hs_date summary) (ms_mod summary) [unlinked]
pure (map snd warnings, linkable)

-- | Set a 'WarningFlag' only if it is not already set as fatal.
wopt_set_nonfatal :: DynFlags -> WarningFlag -> DynFlags
wopt_set_nonfatal dflags w
| wopt_fatal w dflags = dflags
| otherwise = wopt_set dflags w

demoteTypeErrorsToWarnings :: ParsedModule -> ParsedModule
demoteTypeErrorsToWarnings =
(update_pm_mod_summary . update_hspp_opts) demoteTEsToWarns where

demoteTEsToWarns :: DynFlags -> DynFlags
-- convert the errors into warnings, and also check the warnings are enabled
demoteTEsToWarns = (`wopt_set_nonfatal` Opt_WarnDeferredTypeErrors)
. (`wopt_set_nonfatal` Opt_WarnTypedHoles)
. (`wopt_set_nonfatal` Opt_WarnDeferredOutOfScopeVariables)
demoteTEsToWarns = (`wopt_set` Opt_WarnDeferredTypeErrors)
. (`wopt_set` Opt_WarnTypedHoles)
. (`wopt_set` Opt_WarnDeferredOutOfScopeVariables)
. (`gopt_set` Opt_DeferTypeErrors)
. (`gopt_set` Opt_DeferTypedHoles)
. (`gopt_set` Opt_DeferOutOfScopeVariables)

enableTopLevelWarnings :: ParsedModule -> ParsedModule
enableTopLevelWarnings =
(update_pm_mod_summary . update_hspp_opts)
((`wopt_set_nonfatal` Opt_WarnMissingPatternSynonymSignatures) .
(`wopt_set_nonfatal` Opt_WarnMissingSignatures))
((`wopt_set` Opt_WarnMissingPatternSynonymSignatures) .
(`wopt_set` Opt_WarnMissingSignatures))
-- the line below would show also warnings for let bindings without signature
-- ((`wopt_set_nonfatal` Opt_WarnMissingSignatures) . (`wopt_set_nonfatal` Opt_WarnMissingLocalSignatures)))
-- ((`wopt_set` Opt_WarnMissingSignatures) . (`wopt_set` Opt_WarnMissingLocalSignatures)))

update_hspp_opts :: (DynFlags -> DynFlags) -> ModSummary -> ModSummary
update_hspp_opts up ms = ms{ms_hspp_opts = up $ ms_hspp_opts ms}
Expand Down

0 comments on commit 20e4ede

Please sign in to comment.