Better parse error for missing paren after with

This commit is contained in:
Steve Dunham 2022-04-28 13:27:50 -07:00 committed by G. Allais
parent 912112ba97
commit 04e65529f6
5 changed files with 17 additions and 2 deletions

View File

@ -1050,7 +1050,7 @@ withFlags fname
withProblem : OriginDesc -> Int -> IndentInfo -> Rule PWithProblem
withProblem fname col indents
= do rig <- multiplicity fname
start <- bounds (decoratedSymbol fname "(")
start <- mustWork $ bounds (decoratedSymbol fname "(")
wval <- bracketedExpr fname start indents
prf <- optional (decoratedKeyword fname "proof"
*> UN . Basic <$> decoratedSimpleBinderName fname)

View File

@ -81,7 +81,7 @@ idrisTestsError = MkTestPool "Error messages" [] Nothing
-- Parse errors
"perror001", "perror002", "perror003", "perror004", "perror005",
"perror006", "perror007", "perror008", "perror009", "perror010",
"perror011", "perror012", "perror013", "perror014"]
"perror011", "perror012", "perror013", "perror014", "perror015"]
idrisTestsInteractive : TestPool
idrisTestsInteractive = MkTestPool "Interactive editing" [] Nothing

View File

@ -0,0 +1,4 @@
foo : Nat -> Nat
foo a with a
_ | 0 = a
_ | S k = a

View File

@ -0,0 +1,8 @@
1/1: Building ParseWith (ParseWith.idr)
Error: Expected '('.
ParseWith:2:12--2:13
1 | foo : Nat -> Nat
2 | foo a with a
^

3
tests/idris2/perror015/run Executable file
View File

@ -0,0 +1,3 @@
rm -rf build
$1 --no-color --console-width 0 --check ParseWith.idr || true