[Merged by Bors] - fix(ClickSuggestions): instantiate all metavariables in the local context#41001
Closed
JovanGerb wants to merge 1 commit into
Closed
Conversation
PR summary 85fabd70e2Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
joneugster
approved these changes
Jun 25, 2026
|
🚀 Pull request has been placed on the maintainer queue by joneugster. |
Member
|
Thanks! bors merge |
mathlib-bors Bot
pushed a commit
that referenced
this pull request
Jun 26, 2026
…text (#41001) This PR fixes the panic in `#click_suggestions` that was reported at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.23click_suggestions.20doesn.27t.20find.20lemma/near/606231763 There are two separate problems that this PR fixes: 1. The implementation of `#click_suggestion` assumes all metavariables have already been instantiated. This is valid because they are all instantiated at the very beginning. However, this was not done properly, causing the types of free variables to still be able to contain metavariables. 2. The function `viewKAbstractSubExpr` was able to reach its `unreachable!` block. The reason is that `kabstractPositions` calls `instantiateMVars` on the expression `e` but not on the pattern `p`, causing a discrepancy. This is fixed by removing the `instantiateMVars` call. This is fine, because in both of the use cases (`rw??` and `#click_suggestions`), the expressions already have instantiated metavariables at this point.
Contributor
|
Pull request successfully merged into master. Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the panic in
#click_suggestionsthat was reported at https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/.23click_suggestions.20doesn.27t.20find.20lemma/near/606231763There are two separate problems that this PR fixes:
#click_suggestionassumes all metavariables have already been instantiated. This is valid because they are all instantiated at the very beginning. However, this was not done properly, causing the types of free variables to still be able to contain metavariables.viewKAbstractSubExprwas able to reach itsunreachable!block. The reason is thatkabstractPositionscallsinstantiateMVarson the expressionebut not on the patternp, causing a discrepancy. This is fixed by removing theinstantiateMVarscall. This is fine, because in both of the use cases (rw??and#click_suggestions), the expressions already have instantiated metavariables at this point.