Many of our tests in `tests/lean/run/` produce output from `#eval` (or `#check`) statements, that is then ignored. This PR tries to capture all the useful output using `#guard_msgs`. I've only done a cursory check that the output is still sane --- there is a chance that some "unchecked" tests have already accumulated regressions and this just cements them! In the other direction, I did identify two rotten tests: * a minor one in `setStructInstNotation.lean`, where a comment says `Set Nat`, but `#check` actually prints `?_`. Weird? * `CompilerProbe.lean` is generating empty output, apparently indicating that something is broken, but I don't know the signficance of this file. In any case, I'll ask about these elsewhere. (This started by noticing that a recent `grind` test file had an untested `trace_state`, and then got carried away.)
48 lines
973 B
Text
48 lines
973 B
Text
import Lean
|
|
|
|
open Lean
|
|
open Lean.Meta
|
|
def tst (declName : Name) : MetaM Unit := do
|
|
IO.println (← getUnfoldEqnFor? declName)
|
|
|
|
def foo (xs ys zs : List Nat) : List Nat :=
|
|
match (xs, ys) with
|
|
| (xs', ys') =>
|
|
match zs with
|
|
| z::zs => foo xs ys zs
|
|
| _ => match ys' with
|
|
| [] => [1]
|
|
| _ => [2]
|
|
|
|
/-- info: (some foo.eq_def) -/
|
|
#guard_msgs in
|
|
#eval tst ``foo
|
|
|
|
/--
|
|
info: foo.eq_def (xs ys zs : List Nat) :
|
|
foo xs ys zs =
|
|
match (xs, ys) with
|
|
| (xs', ys') =>
|
|
match zs with
|
|
| z :: zs => foo xs ys zs
|
|
| x =>
|
|
match ys' with
|
|
| [] => [1]
|
|
| x => [2]
|
|
-/
|
|
#guard_msgs in
|
|
#check foo.eq_def
|
|
|
|
|
|
def bar (xs ys : List Nat) : List Nat :=
|
|
match xs ++ [], ys ++ [] with
|
|
| xs', ys' => xs' ++ ys'
|
|
|
|
/--
|
|
info: def bar : List Nat → List Nat → List Nat :=
|
|
fun xs ys =>
|
|
match xs ++ [], ys ++ [] with
|
|
| xs', ys' => xs' ++ ys'
|
|
-/
|
|
#guard_msgs in
|
|
#print bar -- should not contain either `let _discr` aux binding
|