Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pp.mvars and pp.mvars.withType #3798

Merged
merged 3 commits into from
Mar 29, 2024
Merged

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Mar 28, 2024

  • 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

kmill added 2 commits March 28, 2024 04:47
When making tests, it is inconvenient using `#guard_msgs` when there are metavariables, since the unique numbering is subject to change.

Setting `pp.mvars` to false causes metavariables to pretty print as placeholders (`_`).

Setting `pp.mvars.withType` to true causes metavariables to pretty print with type ascriptions.

Closes leanprover#3781
@kmill kmill requested a review from Vtec234 as a code owner March 28, 2024 12:06
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Mar 28, 2024
@kmill kmill requested a review from kim-em as a code owner March 29, 2024 15:58
Copy link
Collaborator

@nomeata nomeata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kmill kmill added this pull request to the merge queue Mar 29, 2024
Merged via the queue into leanprover:master with commit 9cb114e Mar 29, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: pp.showNumericNames
2 participants