fix: return optional result
cc @Kha
This commit is contained in:
parent
e8cf086641
commit
702ceb7a3f
2 changed files with 9 additions and 1 deletions
|
|
@ -85,7 +85,7 @@ def doFinally := parser! "finally " >> doSeq
|
|||
|
||||
@[builtinDoElemParser] def doBreak := parser! "break"
|
||||
@[builtinDoElemParser] def doContinue := parser! "continue"
|
||||
@[builtinDoElemParser] def doReturn := parser!:leadPrec "return " >> optional termParser
|
||||
@[builtinDoElemParser] def doReturn := parser!:leadPrec withPosition ("return " >> optional (checkLineEq >> termParser))
|
||||
@[builtinDoElemParser] def doDbgTrace := parser!:leadPrec "dbgTrace! " >> ((interpolatedStr termParser) <|> termParser)
|
||||
@[builtinDoElemParser] def doAssert := parser!:leadPrec "assert! " >> termParser
|
||||
|
||||
|
|
|
|||
8
tests/lean/run/returnOptIssue.lean
Normal file
8
tests/lean/run/returnOptIssue.lean
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#lang lean4
|
||||
|
||||
def f (x : Nat) : IO Unit := do
|
||||
if x > 10 then
|
||||
return
|
||||
throw $ IO.userError "x ≤ 10"
|
||||
|
||||
#eval f 11
|
||||
Loading…
Add table
Reference in a new issue