-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: PackMutual: Deal with extra arguments
previously, it would ignore a recursive call that has extra arguments, which can happen when the recursive functions return something of function type. Therefore just leave them extra arguments in place. Fixes #2883.
- Loading branch information
Showing
2 changed files
with
30 additions
and
3 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,25 @@ | ||
/-! | ||
Test that PackMutual isn't confused when a recursive call has more arguments than is packed | ||
into the unary argument, which can happen if the retturn type is a function type. | ||
-/ | ||
|
||
mutual | ||
inductive A : Type | ||
| baseA : A | ||
| fromB : B → A | ||
|
||
inductive B : Type | ||
| fromA : A → B | ||
end | ||
|
||
mutual | ||
def foo : B → Prop | ||
| .fromA a => bar a 0 | ||
|
||
def bar : A → Nat → Prop | ||
| .baseA => (fun _ => True) | ||
| .fromB b => (fun (c : Nat) => ∃ (t : Nat), foo b) | ||
end | ||
termination_by | ||
foo x => sizeOf x | ||
bar x => sizeOf x |