lean4-htt/tests/elab/liftMethodInMacrosIssue.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

37 lines
653 B
Text

def foo (x : Nat) : IO Bool := do
if x == 0 then
throw $ IO.userError "foo: unexpected zero"
pure (x == 1)
def tst (x : Nat) : IO Unit := do
if x == 0 then
IO.println "x is 0"
else if (← foo x) then
IO.println "x is 1"
else
IO.println "other"
/-- info: x is 0 -/
#guard_msgs in
#eval tst 0
/-- info: x is 1 -/
#guard_msgs in
#eval tst 1
/-- info: other -/
#guard_msgs in
#eval tst 2
syntax term "<|||>" term : doElem
macro_rules
| `(doElem| $a:term <|||> $b) => `(doElem| if (← $a) then pure true else $b:term)
def tst2 : IO Bool := do
pure true <|||> (← throw $ IO.userError "failed")
/-- info: true -/
#guard_msgs in
#eval tst2