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.)
68 lines
1.6 KiB
Text
68 lines
1.6 KiB
Text
namespace Test
|
||
|
||
abbrev Set (α : Type) := α → Prop
|
||
axiom setOf {α : Type} : (α → Prop) → Set α
|
||
axiom mem {α : Type} : α → Set α → Prop
|
||
axiom univ {α : Type} : Set α
|
||
axiom Union {α : Type} : Set (Set α) → Set α
|
||
|
||
syntax:100 (priority := high) term " ∈ " term:99 : term
|
||
|
||
macro_rules
|
||
| `($x ∈ $s) => `(mem $x $s)
|
||
|
||
declare_syntax_cat index
|
||
|
||
syntax term : index
|
||
-- `≤` has precedence 50
|
||
syntax term:51 "≤" ident "<" term:51 : index
|
||
syntax ident ":" term : index
|
||
|
||
syntax "{" index " | " term "}" : term
|
||
|
||
macro_rules
|
||
| `({$l:term ≤ $x < $u | $p}) => `(setOf (fun $x => $l ≤ $x ∧ $x < $u ∧ $p))
|
||
| `({$x:ident : $t | $p}) => `(setOf (fun ($x : $t) => $p))
|
||
| `({$x:term ∈ $s | $p}) => `(setOf (fun $x => $x ∈ $s ∧ $p))
|
||
| `({$x:term ≤ $e | $p}) => `(setOf (fun $x => $x ≤ $e ∧ $p))
|
||
| `({$b:term | $r}) => `(setOf (fun $b => $r))
|
||
|
||
/-- info: setOf fun x => 1 ≤ x ∧ x < 10 ∧ x ≠ 5 : Set Nat -/
|
||
#guard_msgs in
|
||
#check { 1 ≤ x < 10 | x ≠ 5 }
|
||
|
||
/-- info: setOf fun f => f 1 > 0 : Set (Nat → Nat) -/
|
||
#guard_msgs in
|
||
#check { f : Nat → Nat | f 1 > 0 }
|
||
|
||
syntax "⋃ " term ", " term : term
|
||
|
||
macro_rules
|
||
| `(⋃ $b, $r) => `(Union {$b:term | $r})
|
||
|
||
/-- info: Union (setOf fun x => x = x) : Set ?m.4501 -/
|
||
#guard_msgs in
|
||
#check ⋃ x, x = x
|
||
|
||
/-- info: Union (setOf fun x => x = x) : Set Unit -/
|
||
#guard_msgs in
|
||
#check ⋃ (x : Set Unit), x = x
|
||
|
||
/-- info: Union (setOf fun x => mem x univ ∧ x = x) : Set ?m.4538 -/
|
||
#guard_msgs in
|
||
#check ⋃ x ∈ univ, x = x
|
||
|
||
syntax "#check2" term : command
|
||
|
||
macro_rules
|
||
| `(#check2 $e) => `(#check $e #check $e)
|
||
|
||
/--
|
||
info: 1 : Nat
|
||
---
|
||
info: 1 : Nat
|
||
-/
|
||
#guard_msgs in
|
||
#check2 1
|
||
|
||
end Test
|