checker: error on empty integer range in for-in loop#27833
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 665218db47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a971c98cdb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Ok for me its good now. |
|
I've updated the test expectation to 2:14 as requested |
|
Sorry, I gave you the wrong instruction. I ran the targeted test before running v fmt on the .vv file. v fmt changes the indentation to tabs, making 2:11 the correct position. I retested it and the test passes with 2:11. Please just drop your latest commit and make sure to run v fmt on vlib/v/checker/tests/for_in_empty_range_err.vv. Thanks! |
a37a574 to
28adf68
Compare
|
Your latest commit correctly restored 2:11, but it accidentally added cmd/tools/vbug-report-send.lock and the relevant files are still not formatted. Please remove the lock file and run v fmt on Thanks :) |
86e9b3d to
28adf68
Compare
|
i am sorry, is it okay now? |
28adf68 to
0815ec5
Compare
|
On the current HEAD, these two files are still not vfmt'ed for me: |
|
Ah, my bad.. |
|
Thanks for your contribution! |
|
If you run |
|
I noticed the CI failed on |
|
Yes, at first glance, the CI errors didn’t seem to come from your PR. I can see that Alex patched all of that recently as well. You did the right thing by rebasing onto the upstream branch to check the CI again. In any case, I can’t merge your work myself here, @medvednikov is the one who gives the final approval. :) |
|
Everything looks good for this. The CI failures do appear to be unrelated. |
This PR adds a semantic check to prevent empty hardcoded integer ranges (e.g.,
for i in 4 .. 2) infor ... inloops.Because V ranges are exclusive (
start .. end), a loop wherestart >= endwill never execute. Previously, this would silently compile and skip the loop entirely. This change aligns with V's strictness by catching this unreachable code and potential typo at compile time with a hard error.Resolves #27720
Tests
Added
for_in_empty_range_err.vvandfor_in_empty_range_err.outtovlib/v/checker/tests/to cover this specific compiler error.