Skip to content

Conversation

@kim-em
Copy link
Collaborator

@kim-em kim-em commented Jan 8, 2026

This PR adds utility functions for managing the message log during tactic
evaluation, and refactors existing code to use them.

New helpers in Lean.Elab.Tactic:

  • withSuppressedMessages: executes an action while suppressing new messages
  • withCapturedMessages: executes an action and returns any new messages
  • hasErrorMessages: checks if a message list contains errors

Refactored to use these helpers:

  • LibrarySearch.tryDischarger: now uses withSuppressedMessages
  • Try.evalAndSuggest: now uses withSuppressedMessages
  • Try.evalAndSuggestWithBy: now uses withSuppressedMessages

These helpers provide a standard pattern for tactic validation that needs to
inspect error messages (e.g., filtering out suggestions that produce errors).

🤖 Prepared with Claude Code

This PR adds utility functions for managing the message log during tactic
evaluation, and refactors existing code to use them.

New helpers in `Lean.Elab.Tactic`:
- `withSuppressedMessages`: executes an action while suppressing new messages
- `withCapturedMessages`: executes an action and returns any new messages
- `hasErrorMessages`: checks if a message list contains errors

Refactored to use these helpers:
- `LibrarySearch.tryDischarger`: now uses `withSuppressedMessages`
- `Try.evalAndSuggest`: now uses `withSuppressedMessages`
- `Try.evalAndSuggestWithBy`: now uses `withSuppressedMessages`

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kim-em kim-em requested a review from leodemoura as a code owner January 8, 2026 05:17
@kim-em kim-em added the changelog-language Language features and metaprograms label Jan 8, 2026
@kim-em kim-em enabled auto-merge January 8, 2026 05:21
@kim-em kim-em added this pull request to the merge queue Jan 8, 2026
Merged via the queue into master with commit 0ad15fe Jan 8, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants