Skip to content
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

[Bug #20468] More strictly check loop variable #10723

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nobu
Copy link
Member

@nobu nobu commented May 4, 2024

Prohibit a constant and safe navigation call as a loop variable of for.

Prohibit a constant and safe navigation call as a loop variable of
`for`.
}.should complain(/already initialized constant/)
CONST.should == 3
n.should == 3
ruby_bug("#20468", ""..."3.4") do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this PR will be backported?
I would think not as-is since it could emit SyntaxError where it previously worked OK (although weird code).
If not backported, I think we should keep the old spec under ruby_version_is ""..."3.4" do and add the new spec under ruby_version_is "3.4" do

Copy link
Member Author

@nobu nobu May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm uncertain yet whether this would be desirable and it should be backported.
I'll ask matz on the next Tuesday.

IMO, the current behavior is not expected and not a specification, so ""..."3.4" part does is unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants