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: do not propagate pretty printer errors through messages #3696

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

tydeu
Copy link
Member

@tydeu tydeu commented Mar 16, 2024

This PR makes all message constructors handle pretty printer errors.

Prior to this change, pretty printer errors in messages were not uniformly handled. In core, some printers capture their errors (e.g., ppExprWithInfos and ppTerm ) and some do not (e.g., ppGoal and ppSignature) propagate them to whatever serializes the message (e.g., the frontend).

To resolve this inconsistency and uniformly handle errors, the signature for ofLazy now uses BaseIO. As such, all printers been adapted to capture any errors within them and print similar messages to ppExprWithInfos and ppTerm on such errors.

@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 16, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Mar 16, 2024

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 0b01ceb3bb3334fd6c2f3b24996646046722c62a --onto 0ec8862103e397715854a7a6962ce542bba4884d. (2024-03-16 20:03:01)
  • ❌ Mathlib branch lean-pr-testing-3696 built against this PR, but linting failed. (2024-03-26 00:03:12) View Log
  • ❌ Mathlib branch lean-pr-testing-3696 built against this PR, but linting failed. (2024-03-26 00:23:32) View Log
  • ❌ Mathlib branch lean-pr-testing-3696 built against this PR, but linting failed. (2024-03-26 01:31:06) View Log

@tydeu tydeu marked this pull request as ready for review March 21, 2024 20:34
@tydeu tydeu added the will-merge-soon …unless someone speaks up label Mar 21, 2024
@nomeata
Copy link
Collaborator

nomeata commented Mar 25, 2024

I guess this needs master merged into into it (or rebaesd onto master) to unblock CI. Sorry for that.

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 25, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 25, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Mar 26, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 26, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 26, 2024
@tydeu
Copy link
Member Author

tydeu commented Mar 26, 2024

Looking through the Mathlib/Std failures, there are some direct replications of ppSignature code in core which are producing errors now. To make fixing this easier, I extract this element into a separate MessageData helper ofSignature (like ofSyntax and ofExpr) that the downstream use cases can utilize. The other failures are just signature fixes and places were Mathlib/Std should now catch potential pretty-printer errors and handle them properly as well.

@semorrison Should I make PRs to the Mathlib/Std testing branches or is this something you can handle?

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 26, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 26, 2024
@tydeu tydeu removed the will-merge-soon …unless someone speaks up label Mar 26, 2024
@kim-em
Copy link
Collaborator

kim-em commented Apr 22, 2024

@semorrison Should I make PRs to the Mathlib/Std testing branches or is this something you can handle?

Sorry, missed this earlier. Could you rebase onto nightly-with-mathlib (which should be quite recent), and then I can take a look.

@kim-em
Copy link
Collaborator

kim-em commented Dec 10, 2024

@tydeu, would you be able to rebase this onto nightly-with-mathlib?

@tydeu
Copy link
Member Author

tydeu commented Dec 10, 2024

@kim-em I can certainly try! :-)

@tydeu tydeu added the changelog-language Language features, tactics, and metaprograms label Dec 10, 2024
@tydeu tydeu requested a review from digama0 as a code owner December 10, 2024 03:37
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Dec 10, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 10, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Dec 10, 2024

Mathlib CI status (docs):

@tydeu
Copy link
Member Author

tydeu commented Dec 10, 2024

@kim-em The PR is now updated and rebased on the latest nightly-with-mathlib. i haven't investigated the Mathlib failure yet, though.

kim-em added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 10, 2024
@kim-em kim-em removed the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Dec 10, 2024
@kim-em
Copy link
Collaborator

kim-em commented Dec 10, 2024

Mathlib fix looks straightforward, hopefully CI will agree.

@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Dec 10, 2024
@tydeu
Copy link
Member Author

tydeu commented Dec 10, 2024

@kim-em LGTM! Should I throw it on the queue?

@kim-em kim-em added this pull request to the merge queue Dec 11, 2024
Merged via the queue into leanprover:master with commit 19fb1fb Dec 11, 2024
21 checks passed
@tydeu tydeu deleted the pp-baseio branch December 11, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features, tactics, and metaprograms 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.

6 participants