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

Fix 3.4 prototype rb failure #1713

Merged
merged 1 commit into from
Jan 9, 2024
Merged

Fix 3.4 prototype rb failure #1713

merged 1 commit into from
Jan 9, 2024

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Jan 9, 2024

prototype rb in Ruby 3.4 generates record type for more hash literals, with keys of string literals.

That was because the parser <=3.3 generates LIT node for hash keys.

# In Ruby 3.3
irb(main):001> RubyVM::AbstractSyntaxTree.parse('"a"')
=> (SCOPE@1:0-1:3 tbl: [] args: nil body: (STR@1:0-1:3 "a"))
irb(main):002> RubyVM::AbstractSyntaxTree.parse('{ "a" => 1 }')
=> (SCOPE@1:0-1:12 tbl: [] args: nil body: (HASH@1:0-1:12 (LIST@1:2-1:10 (LIT@1:2-1:5 "a") (LIT@1:9-1:10 1) nil)))

Ruby 3.4 fixed this issue generating STR node for hash keys too and caused test failure.

This PR updates the test to expect a record type, and test if LIT is for a string for <=3.3. This will change the result of rbs prototype rb to generate more record types for hash literals.

@soutaro soutaro added this to the RBS 3.5 milestone Jan 9, 2024
@soutaro soutaro enabled auto-merge January 9, 2024 02:26
@soutaro soutaro force-pushed the fix-prototype-test branch from d760480 to 14e8911 Compare January 9, 2024 02:27
@soutaro soutaro added this pull request to the merge queue Jan 9, 2024
Merged via the queue into master with commit fd7036e Jan 9, 2024
23 checks passed
@soutaro soutaro deleted the fix-prototype-test branch January 9, 2024 02:35
@soutaro soutaro added the Released PRs already included in the released version label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

1 participant