-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: store local context for 'don't know how to synthesize implicit a…
…rgument' errors (#5658) When named arguments introduce eta arguments, the full application contains fvars for these eta arguments, so `MVarErrorKind.implicitArg` needs to keep a local context for its error messages. This is because the local context of the mvar associated to the `MVarErrorKind` is not sufficient, since when an eta argument come after an implicit argument, the implicit argument's mvar doesn't contain the eta argument's fvar in its local context. Closes #5475
- Loading branch information
Showing
2 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/-! | ||
# Eta arguments had wrong context in "don't know how to synthesize implicit" errors | ||
https://github.com/leanprover/lean4/issues/5475 | ||
-/ | ||
|
||
set_option pp.mvars false | ||
|
||
/-! | ||
Formerly, argument `x` appeared as `_fvar.123` | ||
-/ | ||
|
||
def f {α β : Type} (x: α) (y: β) : α := x | ||
/-- | ||
error: don't know how to synthesize implicit argument 'α' | ||
@f ?_ Nat x Nat.zero | ||
context: | ||
⊢ Type | ||
--- | ||
error: failed to infer definition type | ||
-/ | ||
#guard_msgs in | ||
example := | ||
f (y := Nat.zero) |