Skip to content

Commit 2879735

Browse files
jacgcocreature
authored andcommitted
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
1 parent f9d4e0f commit 2879735

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Development/IDE/Core/Compile.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ unDefer (Reason Opt_WarnDeferredOutOfScopeVariables, fd) = upgradeWarningToError
154154
unDefer ( _ , fd) = fd
155155

156156
upgradeWarningToError :: 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

159162
addRelativeImport :: ParsedModule -> DynFlags -> DynFlags
160163
addRelativeImport modu dflags = dflags

test/exe/Main.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)