mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-10-26 18:02:24 +03:00
Use iWarn for parse errors
This commit is contained in:
parent
10763d2b78
commit
fb4c5e49d0
@ -90,7 +90,7 @@ iWarn fc err =
|
||||
else Nothing
|
||||
where
|
||||
sourceLine :: Maybe String
|
||||
sourceLine = listToMaybe . drop (si - 1) . lines $ src
|
||||
sourceLine = listToMaybe . drop (si - 1) . (++ ["<end of file>"]) . lines $ src
|
||||
|
||||
haveSource :: Bool
|
||||
haveSource = isJust sourceLine
|
||||
|
@ -1519,10 +1519,8 @@ parseProg syn fname input mrk
|
||||
= do i <- getIState
|
||||
case runparser mainProg i fname input of
|
||||
Left err -> do let fc = errorExtent err
|
||||
iWarn fc (Util.Pretty.string $ errorMessage err)
|
||||
i <- getIState
|
||||
case idris_outputmode i of
|
||||
RawOutput h -> iputStrLn (show . fixColour (idris_colourRepl i) . parseErrorDoc $ err)
|
||||
IdeMode n h -> iWarn fc (Util.Pretty.text $ errorMessage err)
|
||||
putIState (i { errSpan = Just fc })
|
||||
return []
|
||||
Right (x, i) -> do putIState i
|
||||
|
@ -72,7 +72,7 @@ errorExtent (ParseError _ err) = sourcePositionFC pos
|
||||
|
||||
-- | A single-line parse error message, including location.
|
||||
errorMessage :: ParseError -> String
|
||||
errorMessage (ParseError _ err) = P.parseErrorTextPretty err
|
||||
errorMessage (ParseError _ err) = init (P.parseErrorTextPretty err)
|
||||
|
||||
-- | A fully formatted parse error, with caret and bar, etc.
|
||||
prettyError :: ParseError -> String
|
||||
|
@ -1,58 +1,58 @@
|
||||
./layout001a.idr:5:1:
|
||||
layout001a.idr:5:1:
|
||||
|
|
||||
5 | y
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001b.idr:5:3:
|
||||
layout001b.idr:5:3:
|
||||
|
|
||||
5 | = y
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001c.idr:3:1:
|
||||
layout001c.idr:3:1:
|
||||
|
|
||||
3 | 2
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001e.idr:6:1:
|
||||
layout001e.idr:6:1:
|
||||
|
|
||||
6 | 3
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001f.idr:6:2:
|
||||
layout001f.idr:6:2:
|
||||
|
|
||||
6 | 3
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001g.idr:6:3:
|
||||
layout001g.idr:6:3:
|
||||
|
|
||||
6 | 3
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001h.idr:6:3:
|
||||
layout001h.idr:6:3:
|
||||
|
|
||||
6 | 3
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001i.idr:6:4:
|
||||
layout001i.idr:6:4:
|
||||
|
|
||||
6 | 3
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001j.idr:6:5:
|
||||
layout001j.idr:6:5:
|
||||
|
|
||||
6 | 3
|
||||
| ^
|
||||
Wrong indention: should be greater than context indentation
|
||||
|
||||
./layout001l.idr:6:1:
|
||||
layout001l.idr:6:1:
|
||||
|
|
||||
6 | y
|
||||
| ^
|
||||
@ -68,7 +68,7 @@ When checking right hand side of term with expected type
|
||||
When checking an application of function Prelude.Applicative.pure:
|
||||
No such variable f
|
||||
|
||||
./mplus2.idr:17:37:
|
||||
mplus2.idr:17:37:
|
||||
|
|
||||
17 | `mplus` pure f
|
||||
| ^
|
||||
|
@ -182,13 +182,13 @@ When checking right hand side of uhOh with expected type
|
||||
|
||||
No such variable Bogus
|
||||
|
||||
./badbangop.idr:7:1:
|
||||
badbangop.idr:7:1:
|
||||
|
|
||||
7 | (!) : List a -> Nat -> Maybe a
|
||||
| ^
|
||||
! is not a valid operator
|
||||
|
||||
./baddoublebang.idr:6:28:
|
||||
baddoublebang.idr:6:28:
|
||||
|
|
||||
6 | doubleBang mmn = do pure !!mmn
|
||||
| ^
|
||||
@ -308,15 +308,15 @@ reg070.idr:7:1-7:
|
||||
| ~~~~~~~
|
||||
Test_show.Te implementation of Prelude.Show.Show is possibly not total due to: Prelude.Show.Test_show.Te implementation of Prelude.Show.Show, method show
|
||||
|
||||
./reg076.idr:8:1:
|
||||
reg076.idr:8:1:
|
||||
|
|
||||
8 | <empty line>
|
||||
8 | <end of file>
|
||||
| ^
|
||||
Missing fixity declaration for Main.:>
|
||||
|
||||
./reg077.idr:3:1:
|
||||
reg077.idr:3:1:
|
||||
|
|
||||
3 | <empty line>
|
||||
3 | <end of file>
|
||||
| ^
|
||||
Missing fixity declaration for Main.:>>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user