lean4-htt/tests/elab/ppFVarsAnonymous.lean
Garmelon a3cb39eac9
chore: migrate more tests to new test suite (#12809)
This PR migrates most remaining tests to the new test suite. It also
completes the migration of directories like `tests/lean/run`, meaning
that PRs trying to add tests to those old directories will now fail.
2026-03-06 16:52:01 +00:00

27 lines
782 B
Text

import Lean
/-!
# Tests for `pp.fvars.anonymous`
When a free variable is not in the local context (a "loose" fvar),
the pretty printer renders it with an internal name like `_fvar.42`.
The `pp.fvars.anonymous` option (default `true`) controls this behavior:
when set to `false`, loose fvars are displayed as `_fvar._`.
-/
open Lean Elab Command in
#guard_msgs in
run_cmd liftTermElabM do
let fvarId : FVarId := { name := .num `_uniq 42 }
let e := Expr.fvar fvarId
let fmt ← Meta.ppExpr e
guard <| s!"{fmt}" == "_fvar.42"
set_option pp.fvars.anonymous false in
open Lean Elab Command in
#guard_msgs in
run_cmd liftTermElabM do
let fvarId : FVarId := { name := .num `_uniq 42 }
let e := Expr.fvar fvarId
let fmt ← Meta.ppExpr e
guard <| s!"{fmt}" == "_fvar._"