inox
inox copied to clipboard
Type error in tip printed from Stainless
In a verification condition on the Stainless side, I have a term that contains this:
if (thiss.order.leq(thiss.array((n - 1))._1, elemRef(0)._1)) {
Return[(Boolean, SortedArray[K, T], Array[(K, T)]), Unit]((false, thiss, elemRef))
} else {
Proceed[(Boolean, SortedArray[K, T], Array[(K, T)]), Unit](())
}
After using --debug=tip
, we get a tip file where the type instantiations on Return
and Proceed
are lost, so Inox understands the expression in the tip file as (and this leads to a type error):
if (thiss!108.order!107.leq!6(thiss!108.array!122.arr!2((n!29 - 1))._1!0, elemRef!41.arr!2(0)._1!0)) {
Return!1[tuple3!0[Boolean, SortedArray!5[K!37, T!91], array!118[tuple2!0[K!37, T!91]]], Cur!0](tuple3!1[Boolean, SortedArray!5[K!37, T!91], array!118[tuple2!0[K!37, T!91]]](false, thiss!108, elemRef!41))
} else {
Proceed!1[Ret!0, Unit!1](Unit!3)
}
Can we add the type instantiations (with _
) in Printer.scala
? (If so, what term should I use?) Can Inox parse it back?
Can we add the type instantiations (with _) in Printer.scala? (If so, what term should I use?) Can Inox parse it back?
Yes, you should be able to add the information inside Printer.scala
, and you'll need to adapt the parser to handle it as well.
The changes in Printer
should take place here. You can use a similar logic to what is used in the case of FunctionInvocation to determine whether to use a qualified identifier (which includes the type annotation).
You'll also need to change the Parser
here to support an optional type ascription.
(Small FYI about using TIP: dependent types aren't supported in the format)