Skip to content

Fix 3.4 prototype rb failure - #1713

Merged
soutaro merged 1 commit into
masterfrom
fix-prototype-test
Jan 9, 2024
Merged

soutaro merged 1 commit into
masterfrom
fix-prototype-test

Conversation

@soutaro

@soutaro soutaro commented Jan 9, 2024

Copy link
Copy Markdown
Member

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
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant