-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make
rw [foo]
look in the local context for foo
before it lo…
…oks in the environment (#2738)
- Loading branch information
Showing
3 changed files
with
33 additions
and
8 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,21 @@ | ||
/-! # Ensure `rw` prioritizes the local context over the environment | ||
This test ensures that `rw [foo]` looks for `foo` in the local context before it looks for a | ||
constant named `foo` in the environment. See issue #2729. | ||
-/ | ||
|
||
-- Introduce `foo` to the environment. | ||
/-- A constant whose name should conflict with that of a local declaration. -/ | ||
def foo : List Nat := [0] | ||
|
||
/-! ## Ensure that `foo` from the LCtx is used instead of the constant `foo` -/ | ||
|
||
example (A B : Prop) (foo : A ↔ B) (b : B) : A := by | ||
rw [foo] -- should be interpreted as `foo : A ↔ B`, not `foo : List Nat`, and succeed | ||
assumption | ||
|
||
/-! ## Ensure that we can access the constant `foo` by writing `rw [_root_.foo]` -/ | ||
|
||
set_option linter.unusedVariables false in | ||
example (A B : Prop) (foo : A ↔ B) : _root_.foo = [0] := by | ||
rw [_root_.foo] -- should be interpreted as `foo : List Nat`, not `foo : A ↔ B`, and succeed |
Empty file.