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
This commit is contained in:
Jacek Generowicz 2019-09-24 20:41:38 +02:00 committed by Moritz Kiefer
parent f9d4e0ffb9
commit 2879735a97
2 changed files with 8 additions and 4 deletions

View File

@ -154,7 +154,10 @@ unDefer (Reason Opt_WarnDeferredOutOfScopeVariables, fd) = upgradeWarningToError
unDefer ( _ , fd) = fd
upgradeWarningToError :: FileDiagnostic -> FileDiagnostic
upgradeWarningToError (nfp, fd) = (nfp, fd{_severity = Just DsError})
upgradeWarningToError (nfp, fd) =
(nfp, fd{_severity = Just DsError, _message = warn2err $ _message fd}) where
warn2err :: T.Text -> T.Text
warn2err = T.intercalate ": error:" . T.splitOn ": warning:"
addRelativeImport :: ParsedModule -> DynFlags -> DynFlags
addRelativeImport modu dflags = dflags

View File

@ -117,9 +117,10 @@ diagnosticTests = testGroup "diagnostics"
_ <- openDoc' "B.hs" "haskell" sourceB
expectDiagnostics $ expectedDs message
in
[ deferralTest "type error" "True" "Couldn't match expected type"
, deferralTest "typed hole" "_" "Found hole"
, deferralTest "out of scope var" "unbound" "Variable not in scope"
[ deferralTest "type error" "True" "Couldn't match expected type"
, deferralTest "typed hole" "_" "Found hole"
, deferralTest "out of scope var" "unbound" "Variable not in scope"
, deferralTest "message shows error" "True" "A.hs:3:5: error:"
]
, testSession "remove required module" $ do