Improve language flexibility#685
Conversation
47abf04 to
0c535f5
Compare
|
Why change the AST as well, instead of desugaring this from PASTs and frontends? Without good reasons, we should keep the language that hits the backends minimal. |
|
Also, AST changes always mean all frontends, plugins etc. will have to be adapted. |
baf7374 to
348c2a5
Compare
|
@marcoeilers @mschwerhoff, I've scaled back the changes, however I still need to change the |
d6a00cc to
2fb2da2
Compare
marcoeilers
left a comment
There was a problem hiding this comment.
A couple of comments and questions
0d16519 to
5608560
Compare
|
Even after what discussed in the meeting, there are still many possible interpretations of the following program:
One definition of the semantics can be the following: there is first a viper-to-viper desugaring and then the verifier checks that in the desugared LHS there are no two variables with the same value using the same field, as already discussed. (Whatever the semantics is, we should not forget to add it to the tutorial.) |
|
Oh, and should the following fail or not? The method returns the permission that is needed for the LHS. Another variant, where the method consumes the permission that is needed for the LHS. Checking well-definedness of the desugared LHS before the call would succeed, but the call would then update a field without having permission to it. That doesn't seem right. My opinion is that both programs should be disallowed, because the well-definedness check of the method call should check the separating conjunction Anyway, I think that checking the well-definedness of the desugared LHS separately from the well-definedness of the call would be wrong. They should be done at once. |
|
@JonasAlaif As mentioned earlier: is there any need for actually extending the core language or can the additional flexibility be desugared after parsing? My impression is: yes it can, and that the additional flexibility, while great for writing Viper programs by hand, is not that important for frontends. Desugaring would allow the AST to remain unchanged; otherwise, frontends, backends, transformers etc. all might have to be adapted. |
|
@mschwerhoff since the de-sugaring seems possible, I've implemented that now and so the |
|
Regarding the encoding, I decided to copy that of Java encodes as The receiver is evaluated before the call and the assignment happens after the call. This means that is accepted. While would be rejected. |
|
@marcoeilers please review 😇 |
c38638f to
c6ec390
Compare
marcoeilers
left a comment
There was a problem hiding this comment.
A couple of suggestions mostly regarding naming, one question about what our new syntax actually allows.
Also, I think a couple of additional tests that check that we get the correct type and name resolution errors for the newly-supported stuff would be great.
|
Ah wait. Before you merge this: Since it's a language change, this is still the kind of thing where it might make sense for you to show it in a Viper meeting first (at least briefly) before it's merged in, both to show the new features and to see if people find any conceptual issues or have any additional ideas. |
b044735 to
0143ce6
Compare
|
The PR is now ready to be merged, just waiting for the next meeting in a week in case there are any concerns. |
|
@marcoeilers I've added the error transformation, but in Silicon at least it has no effect since there's I guess a bug that Silicon just never calls |
Is the transform at the right time?
|
@marcoeilers I was wrong, yeah I had added it before leaving. Then I think that this is ready to merge? |
|
Oh, I didn't realize that the CI failure was because of required changes in the backend. Yes, let's merge this then if the backends both pass. |
Changes the
PAstandAstto make things more flexible. The following statements are now accepted:In the
PAstI have removed thePMethodCall(it would anyway often get parsed asPLocalVarAssign), but the correspondingAstversionMethodCallremains.