mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-28 11:05:17 +03:00
[ parser ] Fix issue where Alt drops incoming commit tag
This commit is contained in:
parent
2e45902048
commit
351b5ba720
@ -329,7 +329,7 @@ doParse s com (Alt {c1} {c2} x y) xs
|
||||
-- Only add the errors together if the second branch
|
||||
-- is also non-committed and non-fatal.
|
||||
then Failure com'' fatal' errs'
|
||||
else Failure False False (errs ++ errs')
|
||||
else Failure com False (errs ++ errs')
|
||||
(Res s _ val xs) => Res s com val xs
|
||||
-- Successfully parsed the first option, so use the outer commit flag
|
||||
Res s _ val xs => Res s com val xs
|
||||
|
@ -355,7 +355,7 @@ doParse s ws com (Alt {c1} {c2} x y) xs
|
||||
-- Only add the errors together if the second branch
|
||||
-- is also non-committed and non-fatal.
|
||||
then Failure com'' fatal' errs'
|
||||
else Failure False False (errs ++ errs')
|
||||
else Failure com False (errs ++ errs')
|
||||
(Res s ws _ val xs) => Res s ws com val xs
|
||||
-- Successfully parsed the first option, so use the outer commit flag
|
||||
Res s ws _ val xs => Res s ws com val xs
|
||||
|
5
tests/idris2/perror016/ParseIf2.idr
Normal file
5
tests/idris2/perror016/ParseIf2.idr
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
test : Int -> Int
|
||||
test a = if a < 10
|
||||
then if a < 0 the 0 else 5
|
||||
else a
|
@ -8,3 +8,14 @@ ParseIf:3:26--3:30
|
||||
3 | test a = if a < 10 the 0 else a
|
||||
^^^^
|
||||
... (14 others)
|
||||
1/1: Building ParseIf2 (ParseIf2.idr)
|
||||
Error: Couldn't parse any alternatives:
|
||||
1: Expected 'then'.
|
||||
|
||||
ParseIf2:4:33--4:37
|
||||
1 |
|
||||
2 | test : Int -> Int
|
||||
3 | test a = if a < 10
|
||||
4 | then if a < 0 the 0 else 5
|
||||
^^^^
|
||||
... (28 others)
|
||||
|
@ -1,3 +1,4 @@
|
||||
rm -rf build
|
||||
|
||||
$1 --no-color --console-width 0 --check ParseIf.idr || true
|
||||
$1 --no-color --console-width 0 --check ParseIf2.idr || true
|
||||
|
@ -35,10 +35,10 @@ Mismatch between: Vect 0 ?elem and List ?a.
|
||||
|
||||
Main> the (Maybe Integer) (pure 4) : Maybe Integer
|
||||
Main> Couldn't parse any alternatives:
|
||||
1: Expected 'case', 'if', 'do', application or operator expression.
|
||||
1: Expected namespaced name.
|
||||
|
||||
(Interactive):1:4--1:8
|
||||
(Interactive):1:10--1:11
|
||||
1 | :t with [] 4
|
||||
^^^^
|
||||
... (45 others)
|
||||
^
|
||||
... (16 others)
|
||||
Main> Bye for now!
|
||||
|
Loading…
Reference in New Issue
Block a user