@@ -147,24 +147,23 @@ typecheckModule :: IdeDefer
147
147
-> ParsedModule
148
148
-> IO (IdeResult TcModuleResult )
149
149
typecheckModule (IdeDefer defer) hsc keep_lbls pm = do
150
- fmap (either (,Nothing ) id ) $
151
- catchSrcErrors (hsc_dflags hsc) " typecheck" $ do
152
-
153
150
let modSummary = pm_mod_summary pm
154
151
dflags = ms_hspp_opts modSummary
155
-
156
152
modSummary' <- initPlugins hsc modSummary
157
- (warnings, tcm ) <- withWarnings " typecheck" $ \ tweak ->
153
+ (warnings, etcm ) <- withWarnings " typecheck" $ \ tweak ->
158
154
let
159
155
session = tweak (hscSetFlags dflags hsc)
160
156
-- TODO: maybe settings ms_hspp_opts is unnecessary?
161
157
mod_summary'' = modSummary' { ms_hspp_opts = hsc_dflags session}
162
158
in
163
- tcRnModule session keep_lbls $ demoteIfDefer pm{pm_mod_summary = mod_summary''}
159
+ catchSrcErrors (hsc_dflags hsc) " typecheck" $ do
160
+ tcRnModule session keep_lbls $ demoteIfDefer pm{pm_mod_summary = mod_summary''}
164
161
let errorPipeline = unDefer . hideDiag dflags . tagDiag
165
162
diags = map errorPipeline warnings
166
163
deferedError = any fst diags
167
- return (map snd diags, Just $ tcm{tmrDeferedError = deferedError})
164
+ case etcm of
165
+ Left errs -> return ((map snd diags) ++ errs, Nothing )
166
+ Right tcm -> return (map snd diags, Just $ tcm{tmrDeferedError = deferedError})
168
167
where
169
168
demoteIfDefer = if defer then demoteTypeErrorsToWarnings else id
170
169
@@ -213,7 +212,7 @@ tcRnModule hsc_env keep_lbls pmod = do
213
212
unload hsc_env_tmp keep_lbls
214
213
215
214
((tc_gbl_env, mrn_info), splices)
216
- <- liftIO $ captureSplices (hscSetFlags (ms_hspp_opts ms) hsc_env) $ \ hsc_env_tmp ->
215
+ <- liftIO $ captureSplices hsc_env_tmp $ \ hsc_env_tmp ->
217
216
do hscTypecheckRename hsc_env_tmp ms $
218
217
HsParsedModule { hpm_module = parsedSource pmod,
219
218
hpm_src_files = pm_extra_src_files pmod,
0 commit comments