Closed NicolasVanPhan closed 3 weeks ago
I think maybe we should be maintaining the invariant that CR_multi
always has at least two l-expressions, so it might be better to figure out why this is being produced in the first place.
I think maybe we should be maintaining the invariant that
CR_multi
always has at least two l-expressions, so it might be better to figure out why this is being produced in the first place.
Oh okay I understand, I thought CR_Multi
was a more general-purpose variant to CR_One
accepting 0 1 or more arguments. I'll try to investigate where this CR_Multi singleton comes from, then.
In the longer run, should we enforce this invariant through typing ? (i.e. | CR_Multi of 'a * 'a * 'a list
) to make sure there are at least two 'a
? Or would it be too cumbersome ?
I didn't manage to reproduce the error on the latest sail2
branch. It only appeared on origin/release.0.18
.
I couldn't dig into the very root cause but the problem seems to be gone on the latest branch,
so I think we can close this one.
The example code below :
Gives the following error :
The error comes from the following source in the Sail compiler :
https://github.com/NicolasVanPhan/sail/blob/release-0.18/src/sail_sv_backend/jib_sv.ml#L967
Additional debug printing of the AST reveals the creturn is a CR_Multi with only 1 return element in the list
I guess we want to allow all
CR_
values as long as they contain 1 and only 1 return element, unless mistaken. That is why this MR allowsCR_Multi
elements (in addition to `CR_One1) if and only if they contain exactly 1 element.With the current MR, the above code snippet compiles successfully.