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.
48 lines
1.5 KiB
Text
48 lines
1.5 KiB
Text
import Lean
|
|
|
|
/-!
|
|
# Test: projection functions have `.abbrev` kernel hints
|
|
|
|
All projection functions receive `.abbrev` kernel hints at creation time.
|
|
Structure projections default to `.reducible` status, while class projections
|
|
default to `.semireducible` status. The `@[reducible]` attribute changes the
|
|
reducibility status but does **not** change the kernel hint.
|
|
|
|
These properties are relied upon by `isNonTrivialRegular` in `ExprDefEq.lean`.
|
|
That function uses the `.abbrev` branch to detect class projections and treat
|
|
them as nontrivial when `backward.whnf.reducibleClassField` is enabled, so that
|
|
`tryHeuristic` applies the argument-comparison heuristic (with the correct
|
|
transparency bump for instance-implicit parameters) instead of unfolding past
|
|
the `.proj` form. If the kernel hints or default reducibility status for
|
|
projections change, `isNonTrivialRegular` must be updated accordingly.
|
|
-/
|
|
|
|
structure Y where
|
|
x : Nat
|
|
|
|
class X where
|
|
x : Nat
|
|
|
|
open Lean
|
|
deriving instance Repr for ReducibilityHints
|
|
|
|
def showHintAndReduceAttr (declName : Name) : CoreM Unit := do
|
|
let info ← getConstInfo declName
|
|
IO.println (repr info.hints)
|
|
IO.println (repr (← getReducibilityStatus declName))
|
|
|
|
-- Structure projection: `.abbrev` hint, `.reducible` status
|
|
/--
|
|
info: Lean.ReducibilityHints.abbrev
|
|
Lean.ReducibilityStatus.reducible
|
|
-/
|
|
#guard_msgs in
|
|
#eval showHintAndReduceAttr ``Y.x
|
|
|
|
-- Class projection: `.abbrev` hint, `.semireducible` status
|
|
/--
|
|
info: Lean.ReducibilityHints.abbrev
|
|
Lean.ReducibilityStatus.semireducible
|
|
-/
|
|
#guard_msgs in
|
|
#eval showHintAndReduceAttr ``X.x
|