Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error in tip printed from Stainless #153

Open
jad-hamza opened this issue May 12, 2021 · 2 comments
Open

Type error in tip printed from Stainless #153

jad-hamza opened this issue May 12, 2021 · 2 comments

Comments

@jad-hamza
Copy link
Contributor

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?

@samarion
Copy link
Member

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.

@samarion
Copy link
Member

(Small FYI about using TIP: dependent types aren't supported in the format)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants