Open yannbolliger opened 3 years ago
The above might work, as is suggested by these examples:
case class Ref[@mutable T](var x:T)
def add(a: @pure Ref[Int], b: Ref[Int]) = { b.x = a.x }
import stainless.lang._
import stainless.annotation._
object Test {
case class Foo(var i: Int)
@extern
def mystery(x: Foo, @pure y: Foo) = {
()
}
def test = {
val a = Foo(0)
val b = Foo(1)
mystery(a, b)
assert(a.i == 0) // fails
assert(b.i == 1) // passes
}
}
After solving #154, the next step is to make the same work for generic ADTs.
Ideas, roadmap
@var
without annotation@mutable
by default@pure
mut
in Rust, can swap the@mutable
flag with@pure
.freshCopy
all the type parameter-typed args.