Open saraswat opened 4 years ago
I opened a pull request to make StdOut.println
callable on any value https://github.com/epfl-lara/stainless/pull/761
In the meantime you can define your own println
function and annotate it @extern
so that Stainless doesn't look at it:
@extern
def println(x: Any): Unit = {
scala.Predef.println(x)
}
@extern
is quite useful to wrap any kind of code that Stainless doesn't support (the code won't be verified but will be compiled normally)
@jad-hamza You might want to add a @pure
annotation to such a function, to inform Stainless that the function will not mutate its arguments. Stainless will otherwise assume that any field that is either mutable or marked @extern
but not @pure
will be mutated by the function call.
Good point!
Reopening because we might want to deal with the toString
issue as well, independently of printing
In general, a function known to Scala (e.g. due to Prelude) but not known to Stainless will make its way all the way to Inox and then cause a crash. For example, this crashes:
object Test {
def f = assume(false)
}
stainless fails on:
with the trace below. How should a user print out a value, then...?
Trace: