lean4-htt/tests/lean/run/ppMVars.lean
Kyle Miller 9cb114eb83
feat: add pp.mvars and pp.mvars.withType (#3798)
* Setting `pp.mvars` to false causes metavariables to pretty print as
`?_`.
* Setting `pp.mvars.withType` to true causes metavariables to pretty
print with type ascriptions.

Motivation: when making tests, it is inconvenient using `#guard_msgs`
when there are metavariables, since the unique numbering is subject to
change.

This feature does not use `⋯` omissions since a metavariable is already
in a sense an omitted term. If repeated metavariables do not appear in
an expression, there is a chance that a term pretty printed with
`pp.mvars` set to false can still elaborate to the correct term, unlike
for other omissions.

(In the future we could consider an option that pretty prints uniquely
numbered metavariables as `?m✝`, `?m✝¹`, `?m✝²`, etc. to be able to tell
them apart, at least in the same pretty printed expression. It would
take care to make sure that these names are stable across different
hovers.)

Closes #3781
2024-03-29 18:03:05 +00:00

50 lines
706 B
Text

/-!
# Testing `pp.mvars`
-/
/-!
Default values
-/
/-- info: ?a : Nat -/
#guard_msgs in #check (?a : Nat)
/-!
Turning off `pp.mvars`
-/
section
set_option pp.mvars false
/-- info: ?_ : Nat -/
#guard_msgs in #check (?a : Nat)
/-- info: ?_ : Nat -/
#guard_msgs in #check (_ : Nat)
end
/-!
Turning off `pp.mvars` and turning on `pp.mvars.withType`.
-/
section
set_option pp.mvars false
set_option pp.mvars.withType true
/-- info: (?_ : Nat) : Nat -/
#guard_msgs in #check (?a : Nat)
/-- info: (?_ : Nat) : Nat -/
#guard_msgs in #check (_ : Nat)
end
/-!
Turning on `pp.mvars.withType`.
-/
section
set_option pp.mvars.withType true
/-- info: (?a : Nat) : Nat -/
#guard_msgs in #check (?a : Nat)
end