Commit a5e9da8f authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan Committed by Ben Gamari
Browse files

Fix off-by-one error in GHCi line reporting (Trac #10578)

Test Plan: I couldn't add tests because apparently line number
reporting was already working correctly when loading script files. I
don't know how to test by running commands using stdin, is this
supported?

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: hvr, thomie

Differential Revision: https://phabricator.haskell.org/D1067
parent 2c9de9c9
......@@ -3,7 +3,7 @@
Arrow command found where an expression was expected:
() >- () -< () >>- () -<< ()
<interactive>:7:15:
<interactive>:6:15:
Couldn't match expected type ‘()’ with actual type ‘Bool’
In the pattern: True
In a stmt of a pattern guard for
......@@ -15,7 +15,7 @@
Arrow command found where an expression was expected:
() ↣ () ↢ () ⤜ () ⤛ ()
<interactive>:14:15:
<interactive>:13:15:
Couldn't match expected type ‘()’ with actual type ‘Bool’
In the pattern: True
In a stmt of a pattern guard for
......@@ -27,7 +27,7 @@
Arrow command found where an expression was expected:
() >- () -< () >>- () -<< ()
<interactive>:21:15:
<interactive>:20:15:
Couldn't match expected type ‘()’ with actual type ‘Bool’
In the pattern: True
In a stmt of a pattern guard for
......
<interactive>:3:5:
<interactive>:2:5:
You can't mix polymorphic and unlifted bindings
a = (# 1 #)
Probable fix: use a bang pattern
<interactive>:4:5:
<interactive>:3:5:
You can't mix polymorphic and unlifted bindings
a = (# 1, 3 #)
Probable fix: use a bang pattern
......
<interactive>:5:1: error:
<interactive>:4:1: error:
Illegal generalised algebraic data declaration for ‘T’
(Use GADTs to allow GADTs)
In the data declaration for ‘T’
......
($$$) :: [a -> c] -> [a] -> [c] -- Defined at <interactive>:2:8
($$$) :: [a -> c] -> [a] -> [c] -- Defined at <interactive>:1:8
data Ghci1.T = A | ... -- Defined at <interactive>:3:10
data Ghci1.T = A | ... -- Defined at <interactive>:2:10
data R = A | ... -- Defined at <interactive>:4:10
data R = A | ... -- Defined at <interactive>:3:10
data T = A {...} -- Defined at <interactive>:3:10
data T = A {a :: Int} -- Defined at <interactive>:3:13
a :: Integer -- Defined at <interactive>:6:5
data T = A {...} -- Defined at <interactive>:2:10
data T = A {a :: Int} -- Defined at <interactive>:2:13
a :: Integer -- Defined at <interactive>:5:5
3
data R = B {a :: Int} -- Defined at <interactive>:9:13
data T = A {Ghci1.a :: Int} -- Defined at <interactive>:3:1
data R = B {a :: Int} -- Defined at <interactive>:8:13
data T = A {Ghci1.a :: Int} -- Defined at <interactive>:2:1
<interactive>:10:1: error:
<interactive>:9:1: error:
Overlapping instances for C [Int] arising from a use of ‘f’
Matching instances:
instance [safe] C [Int] -- Defined at <interactive>:7:10
instance [safe] C a => C [a] -- Defined at <interactive>:9:10
instance [safe] C [Int] -- Defined at <interactive>:6:10
instance [safe] C a => C [a] -- Defined at <interactive>:8:10
In the expression: f [4 :: Int]
In an equation for ‘it’: it = f [4 :: Int]
<interactive>:39:1:
<interactive>:38:1:
Couldn't match type ‘HFalse’ with ‘HTrue’
Expected type: HTrue
Actual type: Or HFalse HFalse
......@@ -7,7 +7,7 @@
In the expression: f $ Baz 'a'
In an equation for ‘it’: it = f $ Baz 'a'
<interactive>:40:1:
<interactive>:39:1:
Couldn't match type ‘HFalse’ with ‘HTrue’
Expected type: HTrue
Actual type: Or HFalse HFalse
......
<interactive>:4:16:
<interactive>:3:16:
Multiple declarations of ‘A’
Declared at: <interactive>:4:12
<interactive>:4:16
Declared at: <interactive>:3:12
<interactive>:3:16
<interactive>:6:16:
<interactive>:5:16:
Multiple declarations of ‘A’
Declared at: <interactive>:6:12
<interactive>:6:16
Declared at: <interactive>:5:12
<interactive>:5:16
<interactive>:6:49: error:
<interactive>:5:49: error:
Couldn't match expected type ‘ListableElem (a, a)’
with actual type ‘a’
‘a’ is a rigid type variable bound by
the instance declaration at <interactive>:6:10
the instance declaration at <interactive>:5:10
Relevant bindings include
b :: a (bound at <interactive>:6:43)
a :: a (bound at <interactive>:6:41)
b :: a (bound at <interactive>:5:43)
a :: a (bound at <interactive>:5:41)
asList :: (a, a) -> [ListableElem (a, a)]
(bound at <interactive>:6:33)
(bound at <interactive>:5:33)
In the expression: a
In the expression: [a, b]
<interactive>:7:9: error:
<interactive>:6:9: error:
Couldn't match type ‘T’
with ‘Ghci1.T’
NB: ‘Ghci1.T’ is defined at <interactive>:3:1-14
‘T’ is defined at <interactive>:6:1-16
NB: ‘Ghci1.T’ is defined at <interactive>:2:1-14
‘T’ is defined at <interactive>:5:1-16
Expected type: T'
Actual type: T
In the expression: C :: T'
......
data T = C | D -- Defined at <interactive>:9:1
type T' = Ghci1.T -- Defined at <interactive>:4:1
data Ghci1.T = A | ... -- Defined at <interactive>:3:10
data Ghci4.T = B | ... -- Defined at <interactive>:6:12
data T = C | ... -- Defined at <interactive>:9:14
data T = ... | D -- Defined at <interactive>:9:18
b :: T' -- Defined at <interactive>:5:5
c :: Ghci4.T -- Defined at <interactive>:8:5
d :: T -- Defined at <interactive>:10:5
data T = C | D -- Defined at <interactive>:8:1
type T' = Ghci1.T -- Defined at <interactive>:3:1
data Ghci1.T = A | ... -- Defined at <interactive>:2:10
data Ghci4.T = B | ... -- Defined at <interactive>:5:12
data T = C | ... -- Defined at <interactive>:8:14
data T = ... | D -- Defined at <interactive>:8:18
b :: T' -- Defined at <interactive>:4:5
c :: Ghci4.T -- Defined at <interactive>:7:5
d :: T -- Defined at <interactive>:9:5
<interactive>:9:4: error:
<interactive>:8:4: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
NB: ‘Planet’ is defined at <interactive>:8:1-36
‘Ghci1.Planet’ is defined at <interactive>:5:1-37
NB: ‘Planet’ is defined at <interactive>:7:1-36
‘Ghci1.Planet’ is defined at <interactive>:4:1-37
In the first argument of ‘pn’, namely ‘Mercury’
In the expression: pn Mercury
<interactive>:10:4: error:
<interactive>:9:4: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
NB: ‘Planet’ is defined at <interactive>:8:1-36
‘Ghci1.Planet’ is defined at <interactive>:5:1-37
NB: ‘Planet’ is defined at <interactive>:7:1-36
‘Ghci1.Planet’ is defined at <interactive>:4:1-37
In the first argument of ‘pn’, namely ‘Venus’
In the expression: pn Venus
<interactive>:11:4: error:
<interactive>:10:4: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
NB: ‘Planet’ is defined at <interactive>:8:1-36
‘Ghci1.Planet’ is defined at <interactive>:5:1-37
NB: ‘Planet’ is defined at <interactive>:7:1-36
‘Ghci1.Planet’ is defined at <interactive>:4:1-37
In the first argument of ‘pn’, namely ‘Mars’
In the expression: pn Mars
<interactive>:13:44: error:
<interactive>:12:44: error:
Couldn't match expected type ‘Planet’
with actual type ‘Ghci1.Planet’
NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-37
‘Planet’ is defined at <interactive>:8:1-36
NB: ‘Ghci1.Planet’ is defined at <interactive>:4:1-37
‘Planet’ is defined at <interactive>:7:1-36
In the pattern: Earth
In an equation for ‘pn’: pn Earth = "E"
<interactive>:10:12: error:
<interactive>:9:12: error:
Couldn't match expected type ‘Ghci1.Planet’
with actual type ‘Planet’
NB: ‘Planet’ is defined at <interactive>:8:1-41
‘Ghci1.Planet’ is defined at <interactive>:5:1-49
NB: ‘Planet’ is defined at <interactive>:7:1-41
‘Ghci1.Planet’ is defined at <interactive>:4:1-49
In the second argument of ‘(==)’, namely ‘Mercury’
In the expression: mercury == Mercury
<interactive>:12:10: error:
<interactive>:11:10: error:
Couldn't match expected type ‘Planet’
with actual type ‘Ghci1.Planet’
NB: ‘Ghci1.Planet’ is defined at <interactive>:5:1-49
‘Planet’ is defined at <interactive>:8:1-41
NB: ‘Ghci1.Planet’ is defined at <interactive>:4:1-49
‘Planet’ is defined at <interactive>:7:1-41
In the second argument of ‘(==)’, namely ‘Earth’
In the expression: Venus == Earth
<interactive>:5:1: error:
<interactive>:4:1: error:
Illegal generalised algebraic data declaration for ‘T’
(Use GADTs to allow GADTs)
In the data declaration for ‘T’
......
1
2
2
data T1 = MkT1 -- Defined at <interactive>:7:1
data T2 = MkT2 -- Defined at <interactive>:9:2
data T1 = MkT1 -- Defined at <interactive>:6:1
data T2 = MkT2 -- Defined at <interactive>:8:2
<interactive>:3:9: error:
<interactive>:2:9: error:
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'
*** Exception: <interactive>:6:5-35: Non-exhaustive patterns in function foo
*** Exception: <interactive>:5:5-35: Non-exhaustive patterns in function foo
pattern Single :: t -> [t] -- Defined at <interactive>:4:1
pattern Single :: t -> [t] -- Defined at <interactive>:3:1
foo :: [Bool] -> [Bool]
[False]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment