on master help sign in
Fix deferred messages (#120)

* Test deferred error report message The text of the deferred {type errors, typed holes, out of scope variables} should call them 'error', instead it reports 'warning'. * Change warning to error in deferred messages

commit2879735a97df592983083244b69b8c718cb52a71 authorJacek Generowicz <jacg@my-post-office.net> dateTue 24 Sep 2019, 20:41 (7 years ago) parentf9d4e0f
2 files changed+8−4
src/Development/IDE/Core/Compile.hs+4−1 test/exe/Main.hs+4−3
src/Development/IDE/Core/Compile.hs+4−1
@@ -154,7 +154,10 @@ unDefer (Reason Opt_WarnDeferredOutOfScopeVariables, fd) = upgradeWarningToError
154154unDefer ( _ , fd) = fd
155155
156156upgradeWarningToError :: FileDiagnostic -> FileDiagnostic
157−upgradeWarningToError (nfp, fd) = (nfp, fd{_severity = Just DsError})
157+upgradeWarningToError (nfp, fd) =
158+ (nfp, fd{_severity = Just DsError, _message = warn2err $ _message fd}) where
159+ warn2err :: T.Text -> T.Text
160+ warn2err = T.intercalate ": error:" . T.splitOn ": warning:"
158161
159162addRelativeImport :: ParsedModule -> DynFlags -> DynFlags
160163addRelativeImport modu dflags = dflags
test/exe/Main.hs+4−3
@@ -117,9 +117,10 @@ diagnosticTests = testGroup "diagnostics"
117117 _ <- openDoc' "B.hs" "haskell" sourceB
118118 expectDiagnostics $ expectedDs message
119119 in
120− [ deferralTest "type error" "True" "Couldn't match expected type"
121− , deferralTest "typed hole" "_" "Found hole"
122− , deferralTest "out of scope var" "unbound" "Variable not in scope"
120+ [ deferralTest "type error" "True" "Couldn't match expected type"
121+ , deferralTest "typed hole" "_" "Found hole"
122+ , deferralTest "out of scope var" "unbound" "Variable not in scope"
123+ , deferralTest "message shows error" "True" "A.hs:3:5: error:"
123124 ]
124125
125126 , testSession "remove required module" $ do