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.)
36 lines
1.1 KiB
Text
36 lines
1.1 KiB
Text
import Lean
|
||
|
||
inductive SF : Type u → Type u → Type (u+1) where
|
||
| seq {as bs cs: Type u}: SF as bs → SF bs cs → SF as cs
|
||
| fan {as bs cs: Type u}: SF as (bs × cs)
|
||
|
||
inductive SF' (m: Type (u+1) → Type u)[Monad m]: Type u → Type u → Type (u+1) where
|
||
| seq {as bs cs: Type u}: SF' m as bs → SF' m bs cs → SF' m as cs
|
||
| fan {as bs cs: Type u}: SF' m as (bs × cs)
|
||
| rswitcher {as bs cs: Type u}: SF' m as (bs × cs) → SF' m as bs
|
||
|
||
def SF.step [Monad m] (sa: as): SF as bs → SF' m as bs × bs
|
||
| seq sf₁ sf₂ =>
|
||
let (sf₁', sb) := sf₁.step sa
|
||
let (sf₂', sc) := sf₂.step sb
|
||
(sf₁'.seq sf₂', sc)
|
||
| fan => sorry
|
||
|
||
open Lean.Compiler
|
||
set_option trace.Compiler.result true
|
||
set_option pp.funBinderTypes true
|
||
set_option pp.letVarTypes true
|
||
run_meta Lean.Compiler.compile #[``SF.step]
|
||
|
||
def SF'.step [Monad m] (sa: as): SF' m as bs → SF'.{u} m as bs × bs
|
||
| seq sf₁ sf₂ =>
|
||
let (sf₁', sb) := sf₁.step sa
|
||
let (sf₂', sc) := sf₂.step sb
|
||
(sf₁'.seq sf₂', sc)
|
||
| fan => sorry
|
||
| rswitcher f =>
|
||
let x := f.step sa
|
||
let (_, (sb, _)) := x
|
||
(rswitcher f, sb)
|
||
|
||
run_meta Lean.Compiler.compile #[``SF'.step]
|