-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve handling of
_
s for inst implicit arguments in explicit…
… `@` mode This PR does two things: 1. Recall that in explicit mode, a `_` in place of an instance implicit argument still does instance synthesis (one can use `(_)` instead to turn it into a true implicit argument). There has been missing terminfo for such arguments. Now hovering will display the synthesized expression and its type. 2. Recall that when there are named arguments, every explicit argument the named arguments depend on become implicit. This was interacting badly with instance arguments in explicit mode, since the `_` special casing mentioned above was not respecting this rule. Now it respects this rule. This PR is operating under the assumption that the named argument feature in item 2 is meant to be active in explicit mode. An alternative to item 2 would be to turn the feature off in explicit mode.
- Loading branch information
Showing
4 changed files
with
80 additions
and
10 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,6 @@ | ||
/-! | ||
# Make sure there is type information on `_` for inst parameters in explicit mode | ||
-/ | ||
|
||
example : Nat := @ite _ True _ 1 2 | ||
--^ textDocument/hover |
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,8 @@ | ||
{"textDocument": {"uri": "file:///explicitAppInstHole.lean"}, | ||
"position": {"line": 4, "character": 29}} | ||
{"range": | ||
{"start": {"line": 4, "character": 29}, "end": {"line": 4, "character": 30}}, | ||
"contents": | ||
{"value": | ||
"```lean\ninstDecidableTrue : Decidable True\n```\n***\nA placeholder term, to be synthesized by unification. \n***\n*import Init.Core*", | ||
"kind": "markdown"}} |
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,27 @@ | ||
/-! | ||
# Tests for app elaborator in explicit mode | ||
-/ | ||
|
||
namespace Test1 | ||
|
||
/-! | ||
Named arguments in explicit mode cause arguments it depends on to become implicit. | ||
However, inst implicit arguments had odd behavior with `_`, since supplying `_` would override | ||
the fact that it should be implicit. | ||
-/ | ||
|
||
theorem foo {p : Prop} [Decidable p] (h : ite p x y = x) : p := sorry | ||
|
||
variable {p : Prop} [Decidable p] {α : Type} (x y : α) (h : ite p x y = x) | ||
|
||
example : p := @foo (h := h) | ||
/-- | ||
error: function expected at | ||
foo h | ||
term has type | ||
p | ||
-/ | ||
#guard_msgs in | ||
example : p := @foo (h := h) _ | ||
|
||
end Test1 |