-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ImperativeCleanup cleaning too much (#1500)
- Loading branch information
1 parent
f7921da
commit ad51a39
Showing
2 changed files
with
40 additions
and
15 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
21 changes: 21 additions & 0 deletions
21
frontends/benchmarks/verification/invalid/TupleCleanup.scala
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 @@ | ||
import stainless.lang._ | ||
import stainless.collection._ | ||
|
||
object TupleCleanup { | ||
def test1(x: BigInt, y: BigInt): (BigInt, BigInt) = { | ||
val (xx, yy) = (x, y) | ||
val boom = Nil[BigInt]().head | ||
(xx, yy) | ||
} | ||
|
||
def test2(xs: List[BigInt]): (List[BigInt], List[BigInt]) = { | ||
decreases(xs) | ||
xs match { | ||
case Nil() => (Nil(), Nil()) | ||
case Cons(i, t) => | ||
val (s2, g2) = test2(t) | ||
val boom = Nil[BigInt]().head | ||
(s2, g2) | ||
} | ||
} | ||
} |