lean4-htt/tests/elab_fail/autoIssue.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

72 lines
1.1 KiB
Text

import Lean
structure A :=
x : Nat
a' : x = 1 := by trivial
#check A.a'
example (z : A) : z.x = 1 := by
have := z.a'
trace_state
exact this
example (z : A) : z.x = 1 := by
have := z.2
trace_state
exact this
#check A.rec
example (z : A) : z.x = 1 := by
have ⟨x, a'⟩ := z
trace_state
subst a'
rfl
example (z : A) : z.x = 1 := by
induction z with
| mk x a' =>
trace_state
subst a'
rfl
structure B :=
x : Nat
y : Nat := 2
example (b : B) : b = { x := b.x, y := b.y } := by
cases b with
| mk x y => trace_state; rfl
open Lean
open Lean.Meta
def tst : MetaM Unit :=
withLocalDeclD `a (mkConst ``A) fun a => do
let e := mkProj ``A 1 a
IO.println (← Meta.ppExpr (← inferType e))
#eval tst
example (z : A) : z.x = 1 := by
match z with
| { a' := h, .. } => trace_state; exact h
example (z : A) : z.x = 1 := by
match z with
| A.mk x a' => trace_state; exact a'
example : A :=
{ x := 1, a' := _ }
example : A :=
A.mk 1 _
def f (x : Nat) (h : x = 1) : A := A.mk x h
example : A :=
f 2 _
example : A := by
apply f
done