lean4-htt/tests/lean/run/ppPiBinderNames.lean
Kyle Miller 7e9ea00ac0
feat: add option pp.piBinderNames (#10374)
This PR adds the options `pp.piBinderNames` and
`pp.piBinderNames.hygienic`. Enabling `pp.piBinderNames` causes
non-dependent pi binder names to be pretty printed, rather than be
omitted. When `pp.piBinderNames.hygienic` is false (the default) then
only non-hygienic such biner names are pretty printed. Setting `pp.all`
enables `pp.piBinderNames` if it is not otherwise explicitly set.

Implementation note: this is exposing the secret pretty printer option
`pp.piBinderNames` that was being used within the signature pretty
printer.

Closes #1134.
2025-09-14 05:15:04 +00:00

97 lines
1.6 KiB
Text

/-!
# Testing pretty printing option `pp.piBinderNames`
-/
/-!
Tests of default options.
-/
section
/-!
Unused name, doesn't print.
-/
/-- info: Nat → Type : Type 1 -/
#guard_msgs in #check (x : Nat) → Type
/-!
Unused hygienic name, doesn't print.
-/
/-- info: Nat → Type : Type 1 -/
#guard_msgs in #check Nat → Type
end
/-!
Tests with `pp.piBinderNames` enabled.
-/
section
set_option pp.piBinderNames true
/-!
Unused name, prints since not hygienic.
-/
/-- info: (x : Nat) → Type : Type 1 -/
#guard_msgs in #check (x : Nat) → Type
/-!
Unused hygienic name, doesn't print.
-/
/-- info: Nat → Type : Type 1 -/
#guard_msgs in #check Nat → Type
end
/-!
Tests with `pp.piBinderNames` and `pp.piBinderNames.hygienic` enabled.
-/
section
set_option pp.piBinderNames true
set_option pp.piBinderNames.hygienic true
/-!
Prints unused name.
-/
/-- info: (x : Nat) → Type : Type 1 -/
#guard_msgs in #check (x : Nat) → Type
/-!
Prints unused hygienic name.
-/
/-- info: (a : Nat) → Type : Type 1 -/
#guard_msgs in #check Nat → Type
end
/-!
Tests with `pp.all`. Enables `pp.piBinderNames`.
-/
section
set_option pp.all true
/-!
Unused name, prints since not hygienic.
-/
/-- info: (x : Nat) → Type : Type 1 -/
#guard_msgs in #check (x : Nat) → Type
/-!
Unused hygienic name, doesn't print.
-/
/-- info: Nat → Type : Type 1 -/
#guard_msgs in #check Nat → Type
set_option pp.piBinderNames.hygienic true
/-!
Prints unused name.
-/
/-- info: (x : Nat) → Type : Type 1 -/
#guard_msgs in #check (x : Nat) → Type
/-!
Prints unused hygienic name.
-/
/-- info: (a : Nat) → Type : Type 1 -/
#guard_msgs in #check Nat → Type
end