lean4-htt/tests/elab/12334.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

24 lines
810 B
Text

import Std.Data.HashMap
/-! Test some basic behavior related to `inline` discovered in #12334 -/
#guard_msgs in
def foo {n : Nat} (m : Std.HashMap Nat (Fin n)) : Std.HashMap Nat (Fin (n + 1)) :=
m.map <| inline fun _ ↦ Fin.castSucc
/-- error: `inline` applied to parameters is invalid -/
#guard_msgs in
def params (n : Nat) : Nat := inline n
#guard_msgs in
def inlineLocal {n : Nat} (m : Std.HashMap Nat (Fin n)) : Std.HashMap Nat (Fin (n + 1)) :=
inline <| foo m
/-- error: `inline` applied to constructor 'List.cons' is invalid -/
#guard_msgs in
def inlineCtor (x : Nat) (xs : List Nat) := inline <| List.cons x xs
/-- error: `inline` applied to non-local declaration 'Lean.Name.mkStr3' is invalid -/
#guard_msgs in
def inlineNonLocal (s1 s2 s3 : String) :=
inline <| Lean.Name.mkStr3 s1 s2 s3