Skip to content

Commit 546e53f

Browse files
authored
Restricting recursiveCallsAndSurroundingUnfoldings to look for recursive calls only (#896)
1 parent 4f84273 commit 546e53f

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/main/scala/viper/silver/ast/utility/Functions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ object Functions {
191191
case uf@Unfolding (_, body) =>
192192
recordCallsAndUnfoldings (body, ufs :+ uf) // note: acc is not recursively-processed - we may want to revisit this decision
193193
case fa@FuncApp (_, args) =>
194-
result +:= (fa, ufs)
194+
if (fa.funcname == f.name){
195+
result +:= (fa, ufs)
196+
}
195197
args.foreach ((n) => recordCallsAndUnfoldings (n, ufs) )
196198
}
197199
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Any copyright is dedicated to the Public Domain.
2+
// http://creativecommons.org/publicdomain/zero/1.0/
3+
4+
predicate OhHi() { true }
5+
6+
function mark(): Bool
7+
{
8+
true
9+
}
10+
11+
function make_your_own_matching_loop(n: Int): Bool
12+
requires OhHi()
13+
{
14+
n <= 0 ? true : (unfolding OhHi() in mark()) && make_your_own_matching_loop(n - 1)
15+
}
16+
17+
method main()
18+
{
19+
fold OhHi()
20+
var f: Bool := make_your_own_matching_loop(49)
21+
//:: ExpectedOutput(assert.failed:assertion.false)
22+
assert f
23+
}

0 commit comments

Comments
 (0)