mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-03 00:55:00 +03:00
Fix bug with what value was propagated from rhs of alt parse failure and add test case for '@' as value constructor.
This commit is contained in:
parent
385a61a364
commit
830e5dc12d
@ -317,8 +317,10 @@ doParse s com (Alt {c1} {c2} x y) xs
|
||||
then Failure com fatal errs
|
||||
else case (assert_total doParse s False y xs) of
|
||||
(Failure com'' fatal' errs') => if com'' || fatal'
|
||||
-- Only add the errors together if the second branch
|
||||
-- is also non-committed and non-fatal.
|
||||
then Failure com fatal' errs'
|
||||
else Failure com'' fatal' (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
|
||||
|
@ -66,7 +66,7 @@ idrisTestsError = MkTestPool "Error messages" [] Nothing
|
||||
"error016", "error017", "error018", "error019",
|
||||
-- Parse errors
|
||||
"perror001", "perror002", "perror003", "perror004", "perror005",
|
||||
"perror006", "perror007", "perror008"]
|
||||
"perror006", "perror007", "perror008", "perror009"]
|
||||
|
||||
idrisTestsInteractive : TestPool
|
||||
idrisTestsInteractive = MkTestPool "Interactive editing" [] Nothing
|
||||
|
4
tests/idris2/perror009/Error1.idr
Normal file
4
tests/idris2/perror009/Error1.idr
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
data Foo : Type where
|
||||
FooBase : Foo
|
||||
(@) : Foo -> Foo -> Foo
|
19
tests/idris2/perror009/expected
Normal file
19
tests/idris2/perror009/expected
Normal file
@ -0,0 +1,19 @@
|
||||
1/1: Building Error1 (Error1.idr)
|
||||
Error: Couldn't parse any alternatives:
|
||||
1: Expected name.
|
||||
|
||||
Error1:4:3--4:4
|
||||
1 |
|
||||
2 | data Foo : Type where
|
||||
3 | FooBase : Foo
|
||||
4 | (@) : Foo -> Foo -> Foo
|
||||
^
|
||||
2: Can't use reserved symbol @.
|
||||
|
||||
Error1:4:4--4:5
|
||||
1 |
|
||||
2 | data Foo : Type where
|
||||
3 | FooBase : Foo
|
||||
4 | (@) : Foo -> Foo -> Foo
|
||||
^
|
||||
|
3
tests/idris2/perror009/run
Normal file
3
tests/idris2/perror009/run
Normal file
@ -0,0 +1,3 @@
|
||||
$1 --no-color --console-width 0 --no-banner -Werror --check Error1.idr
|
||||
|
||||
rm -rf build/
|
@ -32,20 +32,20 @@ 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:10--1:11
|
||||
1 | :t with [] 4
|
||||
^
|
||||
2: Expected '('.
|
||||
|
||||
(Interactive):1:10--1:11
|
||||
1 | :t with [] 4
|
||||
^
|
||||
3: Expected 'if'.
|
||||
|
||||
(Interactive):1:4--1:5
|
||||
1 | :t with [] 4
|
||||
^
|
||||
2: Expected '`'.
|
||||
|
||||
(Interactive):1:4--1:5
|
||||
1 | :t with [] 4
|
||||
^
|
||||
3: Expected operator.
|
||||
|
||||
(Interactive):1:4--1:5
|
||||
1 | :t with [] 4
|
||||
^
|
||||
... (42 others)
|
||||
... (8 others)
|
||||
Main> Bye for now!
|
||||
|
Loading…
Reference in New Issue
Block a user