Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure explicit pattern variables provided by the uses are indee…
…d pattern variables
- Loading branch information
1 parent
90c442d
commit 05a2778
Showing
3 changed files
with
19 additions
and
0 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,13 @@ | ||
structure Pos where | ||
protected succ :: | ||
protected pred : Nat | ||
|
||
protected def Pos.add : Pos → Pos → Pos | ||
| Pos.succ x, Pos.succ y => Pos.succ (x + y).succ | ||
instance : Add Pos := ⟨Pos.add⟩ | ||
|
||
instance (x : Nat) : OfNat Pos x.succ := ⟨Pos.succ x⟩ | ||
|
||
def f : Pos → Pos | ||
| 1 => 1 | ||
| x+1 => f x + x + 1 |
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,2 @@ | ||
invalidPatternIssue.lean:13:0-13:20: error: invalid patterns, `x` is an explicit pattern variable, but it only occurs in positions that are inaccessible to pattern matching | ||
{ pred := Nat.succ .(x.1) } |