Skip to content
Snippets Groups Projects
Commit 275e41a9 authored by Jade's avatar Jade :speech_balloon: Committed by Marge Bot
Browse files

Put the newline after errors instead of before them

This mainly has consequences for GHCi but also slightly alters how the
output of GHC on the commandline looks.

Fixes: #22499
parent 385cd1c4
No related branches found
No related tags found
No related merge requests found
Showing
with 21 additions and 22 deletions
......@@ -417,14 +417,13 @@ defaultLogAction logflags msg_class srcSpan msg
message = mkLocMessageWarningGroups (log_show_warn_groups logflags) msg_class srcSpan msg
printDiagnostics = do
hPutChar stderr '\n'
caretDiagnostic <-
if log_show_caret logflags
then getCaretDiagnostic msg_class srcSpan
else pure empty
printErrs $ getPprStyle $ \style ->
withPprStyle (setStyleColoured True style)
(message $+$ caretDiagnostic)
(message $+$ caretDiagnostic $+$ blankLine)
-- careful (#2302): printErrs prints in UTF-8,
-- whereas converting to string first and using
-- hPutStr would just emit the low 8 bits of
......
[1 of 3] Compiling A ( A.hs, interpreted )
[2 of 3] Compiling B ( B.hs, interpreted )
[3 of 3] Compiling C ( C.hs, interpreted )
A.hs:5:1: warning: [GHC-62161] [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
In an equation for ‘incompletePattern’:
......@@ -17,9 +16,10 @@ B.hs:7:1: warning: [GHC-66111] [-Wunused-imports (in -Wextra)]
C.hs:6:7: error: [GHC-88464]
Variable not in scope: variableNotInScope :: ()
Failed, two modules loaded.
[3 of 3] Compiling C ( C.hs, interpreted )
C.hs:6:7: error: [GHC-88464]
Variable not in scope: variableNotInScope :: ()
Failed, two modules reloaded.
<interactive>:2:5: error: [GHC-20036]
You can't mix polymorphic and unlifted bindings: a = (# 1 #)
Suggested fix: Add a type signature.
......@@ -10,3 +9,4 @@
<interactive>:1:1: error: [GHC-17999]
GHCi can't bind a variable of unlifted type:
a :: (# Integer, Integer #)
Running with -XNoAlternativeLayoutRule
Running with -XAlternativeLayoutRule
layout001.hs:6:3: error: [GHC-58481] parse error on input ‘where’
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
layout001.hs:6:3: warning: [GHC-93617] [-Walternative-layout-rule-transitional (in -Wdefault)]
transitional layout will not be accepted in the future:
`where' clause at the same depth as implicit layout block
Running with -XNoAlternativeLayoutRule
Running with -XAlternativeLayoutRule
layout003.hs:11:4: error: [GHC-58481] parse error on input ‘|’
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
layout003.hs:11:4: warning: [GHC-93617] [-Walternative-layout-rule-transitional (in -Wdefault)]
transitional layout will not be accepted in the future:
`|' at the same depth as implicit layout block
Running with -XNoAlternativeLayoutRule
Running with -XAlternativeLayoutRule
layout004.hs:7:14: error: [GHC-58481] parse error on input ‘,’
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
layout004.hs:7:14: error: [GHC-58481] parse error on input ‘,’
Running with -XNoAlternativeLayoutRule
layout006.hs:12:4: warning: [GHC-53633] [-Woverlapping-patterns (in -Wdefault)]
Pattern match is redundant
In an equation for ‘f’: f | True = ...
Running with -XAlternativeLayoutRule
Running with -XAlternativeLayoutRule
layout006.hs:12:2: error: [GHC-58481] parse error on input ‘|’
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
layout006.hs:12:2: warning: [GHC-93617] [-Walternative-layout-rule-transitional (in -Wdefault)]
transitional layout will not be accepted in the future:
`|' at the same depth as implicit layout block
......@@ -15,3 +14,4 @@ layout006.hs:12:2: warning: [GHC-93617] [-Walternative-layout-rule-transitional
layout006.hs:12:4: warning: [GHC-53633] [-Woverlapping-patterns (in -Wdefault)]
Pattern match is redundant
In an equation for ‘f’: f | True = ...
GHCiDRF.foo :: T -> Int
<interactive>:1:1: error: [GHC-87543]
Ambiguous occurrence ‘GHCiDRF.bar’.
It could refer to
either the field ‘bar’ of record ‘T’, defined at GHCiDRF.hs:3:28,
or the field ‘bar’ of record ‘U’, defined at GHCiDRF.hs:4:16.
type T :: *
data T = MkT {foo :: Int, ...}
-- Defined at GHCiDRF.hs:3:16
......@@ -16,7 +16,6 @@ type U :: *
data U = MkU {bar :: Bool}
-- Defined at GHCiDRF.hs:4:16
GHCiDRF.foo :: GHCiDRF.T -> Int
<interactive>:1:1: error: [GHC-87543]
Ambiguous occurrence ‘GHCiDRF.bar’.
It could refer to
......@@ -26,6 +25,7 @@ GHCiDRF.foo :: GHCiDRF.T -> Int
or the field ‘bar’ belonging to data constructor ‘MkU’,
imported qualified from ‘GHCiDRF’
(and originally defined at GHCiDRF.hs:4:16-18).
type GHCiDRF.T :: *
data GHCiDRF.T = GHCiDRF.MkT {GHCiDRF.foo :: Int, ...}
-- Defined at GHCiDRF.hs:3:16
......@@ -36,7 +36,6 @@ data GHCiDRF.T = GHCiDRF.MkT {..., GHCiDRF.bar :: Int}
type GHCiDRF.U :: *
data GHCiDRF.U = GHCiDRF.MkU {GHCiDRF.bar :: Bool}
-- Defined at GHCiDRF.hs:4:16
<interactive>:11:1: error: [GHC-87543]
Ambiguous occurrence ‘GHCiDRF.bar’.
It could refer to
......@@ -46,3 +45,4 @@ data GHCiDRF.U = GHCiDRF.MkU {GHCiDRF.bar :: Bool}
or the field ‘bar’ belonging to data constructor ‘MkU’,
imported qualified from ‘GHCiDRF’
(and originally defined at GHCiDRF.hs:4:16-18).
w :: [a] -> a
x :: [a] -> a
<interactive>:1:1: error: [GHC-88464]
Variable not in scope: y
Suggested fix:
......@@ -12,3 +11,4 @@ x :: [a] -> a
Suggested fix:
Notice that ‘z’ is a field selector
that has been suppressed by NoFieldSelectors.
......@@ -7,7 +7,6 @@ type T :: * -> *
data T a = MkT {foo :: Bool, ...}
-- Defined at <interactive>:4:18
True
<interactive>:1:1: error: [GHC-87543]
Ambiguous occurrence ‘foo’.
It could refer to
......@@ -15,6 +14,7 @@ True
defined at <interactive>:3:16,
or the field ‘foo’ of record ‘T’,
defined at <interactive>:4:18.
type U :: *
data U = MkU {foo :: Int}
-- Defined at <interactive>:12:16
......
T13839a.hs:10:1: warning: [GHC-40910] [-Wunused-top-binds (in -Wextra, -Wunused-binds)]
Defined but not used: ‘nonUsed’
nonUsed :: ()
nonUsed :: ()
<interactive>:3:9: warning: [GHC-83865] [-Wdeferred-type-errors (in -Wdefault)]
• Couldn't match type ‘[Dec]’ with ‘Exp’
Expected: Q Exp
......@@ -17,3 +16,4 @@
(deferred type error)
Code: x
• In the untyped splice: $x
CaretDiagnostics1.hs:7:8-15: error: [GHC-83865]
• Couldn't match expected type ‘IO a0’ with actual type ‘Int’
• In the second argument of ‘(+)’, namely ‘(3 :: Int)’
......@@ -68,3 +67,4 @@ CaretDiagnostics1.hs:23:25-26: error: [GHC-83865]
|
23 | tabby2 = ()
| ^^
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment