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

32 lines
1,007 B
Text

import Lean.Elab.ElabRules
syntax "kdef " ident (".{" ident,+ "}")? " : " term " := " term : command
open Lean Elab Command Term in
elab_rules : command | `(kdef $name $[.{ $levelParams?,* }]? : $type := $value) => do
let levelParams :=
if let some levelParams := levelParams?
then levelParams.getElems.toList.map (·.getId)
else []
let (type, value) ← runTermElabM fun _ => do
setLevelNames levelParams
let type ← elabTermAndSynthesize type none
let value ← elabTermAndSynthesize value none
return (type, value)
liftCoreM <| addDecl <| .defnDecl {
name := name.getId
levelParams
type
value
hints := .abbrev
safety := .safe
}
kdef Univ'.{u} : Sort (imax 1 u + 1) := Sort (imax 1 u + 1)
def Univ := Univ'.{0}
#check (Univ : Univ) -- !!!
example : Sort (imax u v + 1) := Unit → Sort (imax u v)
-- (kernel) declaration type mismatch, '_example' has type
-- Type (max 0 (imax u v))
-- but it is expected to have type
-- Type (imax u v)