-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[compiler] More tests for "for" loops #11584
Conversation
⏱️ 8h 18m total CI duration on this PR
🚨 1 job on the last run was significantly faster/slower than expected
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11584 +/- ##
=========================================
+ Coverage 68.8% 68.9% +0.1%
=========================================
Files 775 775
Lines 178229 178229
=========================================
+ Hits 122677 122866 +189
+ Misses 55552 55363 -189 ☔ View full report in Codecov by Sentry. |
1b19d7a
to
da54458
Compare
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.
Have some minor comments, LGTM otherwise.
Thanks for doing this!
continue | ||
} | ||
assert!(move x == 5, 42); | ||
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 |
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.
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | |
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
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.
Upper bound is exclusive.
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.
fxied.
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | ||
x = x + 1; // 1, 4, 13, 16, | ||
if (x >= 15) break; | ||
x = x + 2; // 3, 6, 15, - |
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.
x = x + 2; // 3, 6, 15, - | |
x = x + 2; // 3, 6, 15, - |
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.
Indentation here and below (assignments to x
) should be fixed for readability.
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.
oops, emacs added tabs. gotta get rid of that.
@@ -0,0 +1,151 @@ | |||
processed 1 task | |||
|
|||
task 0 'print-bytecode'. lines 1-25: |
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.
What is this *.exp1
file?
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.
oops, was a backup file.
fun main() { | ||
let k = 0; | ||
let y = 0; | ||
for (j in 0..10) { //j: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 |
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.
The indentation in this test is broken: makes it hard to read.
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.
again, tab issue.
@@ -0,0 +1,18 @@ | |||
//# publish |
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.
Looks like many non-for-loop related tests (like this one) were also added. I am assuming this is intentional.
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.
I was making /control_flow/ the same for V1 and V2.
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.
But I've also backpedaled and removed a test that doesn't yield expected warnings on -v2 now.
address 0x42 { | ||
module M { | ||
|
||
// fun t1() { |
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.
Weird to have commented out code here. Any particular reason?
script { | ||
fun main() { | ||
let x = 0; | ||
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 |
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.
Similar comments as made on the "original" file.
y = y + 2; //y: 3, 6, 15, - | ||
let x = 0; | ||
for (i in 0..10) { //i: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | ||
x = x + 1; //x: 1, 4, 13, 16, |
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.
Please fix indentation if possible.
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.
Sorry, tabs again.
408bbaf
to
a167b09
Compare
1981f03
to
bab43d5
Compare
… from -v2/tests since output is incorrect
f75fe69
to
a3418de
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
❌ Forge suite
|
Description
Add a few more tests for
for
loops. Copy some tests over to move-compiler-v2 to also test there.For correct code, use transactional-tests, but for compiler errors, use tests.
Also fix a typo in one test making it not useful.
Addresses Issue #11583.
Test Plan
These are tests.