-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR ensures `Meta.check` check projections. closes #5660
- Loading branch information
1 parent
a8a160b
commit a7d132f
Showing
3 changed files
with
74 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
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,61 @@ | ||
import Lean | ||
|
||
|
||
def ex : ∃ x : Nat, x = 1 := | ||
⟨1, rfl⟩ | ||
|
||
open Lean Meta | ||
|
||
/-- | ||
error: invalid projection | ||
ex.3 | ||
from type | ||
∃ x, x = 1 | ||
-/ | ||
#guard_msgs in | ||
run_meta check (Expr.proj ``Exists 2 (mkConst ``ex)) -- should fail | ||
|
||
/-- | ||
error: invalid projection | ||
ex.1 | ||
from type | ||
∃ x, x = 1 | ||
-/ | ||
#guard_msgs in | ||
run_meta check (Expr.proj ``Exists 0 (mkConst ``ex)) -- should fail | ||
|
||
run_meta check (Expr.proj ``Exists 1 (mkConst ``ex)) | ||
|
||
def p := (1, 2) | ||
|
||
/-- | ||
error: invalid projection | ||
p.1 | ||
from type | ||
Nat × Nat | ||
-/ | ||
#guard_msgs in | ||
run_meta check (Expr.proj ``Exists 0 (mkConst ``p)) -- should fail | ||
|
||
run_meta check (Expr.proj ``Prod 0 (mkConst ``p)) | ||
run_meta check (Expr.proj ``Prod 1 (mkConst ``p)) | ||
|
||
/-- | ||
error: invalid projection | ||
p.3 | ||
from type | ||
Nat × Nat | ||
-/ | ||
#guard_msgs in | ||
run_meta check (Expr.proj ``Prod 2 (mkConst ``p)) -- should fail | ||
|
||
def n := 1 | ||
|
||
/-- | ||
error: invalid projection | ||
n.1 | ||
from type | ||
Nat | ||
-/ | ||
#guard_msgs in | ||
run_meta check (Expr.proj ``Nat 0 (mkConst ``n)) -- should fail |