-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
#eval
command was leaking auxiliary declarations into the envi…
…ronment (#3323)
- Loading branch information
1 parent
56d703d
commit 644d426
Showing
3 changed files
with
57 additions
and
25 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 @@ | ||
import Lean | ||
|
||
#eval match true with | true => false | false => true | ||
|
||
open Lean Elab Command Meta | ||
#eval show CommandElabM Unit from do | ||
match ([] : List Nat) with | ||
| [] => | ||
liftCoreM <| addDecl <| Declaration.defnDecl { | ||
name := `foo | ||
type := Lean.mkConst ``Bool | ||
levelParams := [] | ||
value := Lean.mkConst ``true | ||
hints := .opaque | ||
safety := .safe | ||
} | ||
| _ => return () | ||
|
||
#check foo | ||
-- The auxiliary declarations created to elaborate the commands above | ||
-- should not leak into the environment | ||
#check _eval.match_1 -- Should fail | ||
#check _eval.match_2 -- Should fail |
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,4 @@ | ||
false | ||
foo : Bool | ||
evalLeak.lean:22:7-22:20: error: unknown identifier '_eval.match_1' | ||
evalLeak.lean:23:7-23:20: error: unknown identifier '_eval.match_2' |