-
Notifications
You must be signed in to change notification settings - Fork 38
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
Support conversion of sum types in Apalache #1034
Comments
This is pending on sum types in Quint, right? |
Correct! |
I've hit a snag that will require a bit of redesign on either the Apalache conversion side or the quint IR processing: Given a type declaration like type F = | A
type E = | X(F) The declaration is stored in the IR like so: "15": {
"id": 15,
"name": "E",
"kind": "typedef",
"type": {
"id": 15,
"kind": "sum",
"fields": {
"kind": "row",
"fields": [
{
"fieldName": "X",
"fieldType": {
"id": 14,
"kind": "const",
"name": "F"
}
}
],
"other": { "kind": "empty" }
}
}
}, The snag, for our purposes, is that Our assumption in the quint conversion so far is that we don't need to take account of defined types, and so type constants like this encountered in the IR are just mapped to abstract types in Apalache. As a result, when trying to construct variant application live We have two clear options, afaict:
|
We should have hit the same issue with other data types earlier. Maybe @thpani remembers how it was dealt with |
We already have that, see |
@bugarela I'll look into that! Thanks :) |
Ahhh.. my debugging here is probably very off. I had been assuming that what Apalache gets is essentially the same as the output of I'll have to figure out how to inspect what what is going on there and revise my hypothesis about why we are getting the failure. Taking a step back, here is what is not working as I'd expect: Given type S = | A
type T = | B(S) Apalache conversion is failing with this error from the builder:
And it is failing during this type comparison:
Which, if everything were working as expected, would be the same, by definition. |
Yeah... there's some flattening happening between typecheck and handing off to Apalache. I usually just added a call to |
Just for context: we also have some Quint type flattening logic in Apalache – I'm actually not sure how much overlap there is, but in the current case I think it makes sense to add to |
Thanks for the pointer, @thpani! I don't see any flattening of the relevant sort in the type converter: it is able to do direct conversion without any access to the lookup tables. So I suspect the error is that I neglected to wire in some required visitor method somewhere along the way :) |
No description provided.
The text was updated successfully, but these errors were encountered: