-
Notifications
You must be signed in to change notification settings - Fork 0
If e1 Then s1 'Else skip' adaptation #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5352ab6
If e1 Then s1 'Else skip' adaptation
Pichers 7ac32ca
Added if related tests
Pichers ef6521f
Added the use of edited variables after ifs
Pichers 9526f6e
Added new if then skip permission check test
Pichers 826e637
Added an incorrect test for if without else permissions
Pichers 99e3963
Merge branch 'main' into IfNoElseSupport
Pichers ee05e25
missing comma
Pichers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package latte; | ||
|
|
||
| import specification.Free; | ||
| import specification.Unique; | ||
|
|
||
| /* | ||
| * This file is part of the Latte test suite. | ||
| */ | ||
| class MyNode { | ||
|
|
||
| @Unique Object value; | ||
| @Unique Node next; | ||
|
|
||
| /** | ||
| * Constructor for the Node class using @Free value and next nodes | ||
| * @param value | ||
| * @param next | ||
| */ | ||
| public MyNode (@Free Object value, @Free Node next) { | ||
| this.value = value; | ||
| this.next = next; | ||
| } | ||
|
|
||
| public Object test(@Free Object v1, @Free Object v2, boolean c1, boolean c2){ | ||
| if (c1) { | ||
| this.value = v1; | ||
| } else if (c2) { | ||
| this.value = v2; | ||
| } else { | ||
| this.value = v1; | ||
| } | ||
|
|
||
| if (c2 || this.value == null) { | ||
| this.value = v1; | ||
| } else { | ||
| this.value = v2; | ||
| } | ||
| if (c1 && this.value == v1) { | ||
| this.value = v2; | ||
| } | ||
| return this.value; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package latte; | ||
|
|
||
| import specification.Free; | ||
| import specification.Unique; | ||
|
|
||
| /* | ||
| * This file is part of the Latte test suite. | ||
| */ | ||
| class MyNode { | ||
|
|
||
| @Unique Object value; | ||
| @Unique Node next; | ||
|
|
||
| /** | ||
| * Constructor for the Node class using @Free value and next nodes | ||
| * @param value | ||
| * @param next | ||
| */ | ||
| public MyNode (@Free Object value, @Free Node next) { | ||
| this.value = value; | ||
| this.next = next; | ||
| } | ||
|
|
||
| public Object test(@Free Object v1, boolean c1){ | ||
| if (c1) { | ||
| this.value = v1; | ||
| } | ||
| return this.value; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package latte; | ||
|
|
||
| import specification.Free; | ||
| import specification.Unique; | ||
|
|
||
| class MyNodeIfNoElse { | ||
|
|
||
| @Unique Object value; | ||
|
|
||
| public @Unique Object test(@Free Object v1, boolean cond) { | ||
| Object n; | ||
| n = new Object(); | ||
|
|
||
| this.value = n; | ||
| if (cond) { | ||
| this.value = v1; | ||
| } | ||
| return this.value; // should still be @Unique | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package latte; | ||
|
|
||
| import specification.Free; | ||
| import specification.Unique; | ||
| import specification.Shared; | ||
| import specification.Borrowed; | ||
|
|
||
| class MyNodeIfNoElse { | ||
|
|
||
| @Unique Object value; | ||
|
|
||
| public @Unique Object test(@Shared Object v1, boolean cond) { | ||
| Object n; | ||
| n = new Object(); | ||
|
|
||
| this.value = n; | ||
| if (cond) { | ||
| this.value = v1; | ||
| } | ||
|
|
||
| return this.value; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create at least one more separate test where we check if the return type has the permission required after the if conditions.
For the previous example check if the return is still
@Uniquefor example (might need changes):This way we can check if the information in the context is the expected one.