-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Anonymous lvar #5035
Anonymous lvar #5035
Conversation
Could we pull the |
I tested locally they pass. 👍 |
Haven't they been included in dc8d349? |
🤦 yes, yes they did. |
So I tried this branch against our app and it crashed inside error_highlight:
|
The following is broken though: def foo
end
p RubyVM::AbstractSyntaxTree.of(method(:foo))
def foo(*)
end
p RubyVM::AbstractSyntaxTree.of(method(:foo))
def foo(**)
end
p RubyVM::AbstractSyntaxTree.of(method(:foo))
def foo(*, **)
end
p RubyVM::AbstractSyntaxTree.of(method(:foo))
RubyVM::InstructionSequence.load_from_binary(RubyVM::InstructionSequence.compile_file(__FILE__).to_binary).eval $ ./ruby /tmp/ast.rb
#<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-2:3>
#<RubyVM::AbstractSyntaxTree::Node:SCOPE@5:0-6:3>
#<RubyVM::AbstractSyntaxTree::Node:SCOPE@9:0-10:3>
#<RubyVM::AbstractSyntaxTree::Node:SCOPE@13:0-14:3>
<internal:ast>:67:in `of': wrong argument type nil (expected Array) (TypeError)
from /tmp/ast.rb:3:in `<main>'
from /tmp/ast.rb:17:in `eval'
from /tmp/ast.rb:17:in `<main>' |
As it crashed also on the current master, seems a different bug. |
The explanation in the commit log feels inaccurate or insufficient now. |
```ruby def foo(*); ->{ super }; end ``` This code makes anonymous parameters which is not registered as an ID. The problem is that when Ractors try to scan `getlocal` instructions, it puts the Symbol corresponding to the parameter in to a hash. Since it is not registered, we end up with a strange exception. This commit wraps the unregistered ID in an internal ID so that we get the same exception for `...` as `*`. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: John Hawthorn <john@hawthorn.email>
Just a quick note: this change seems not to work correctly on Solaris. http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20211107T120003Z.fail.html.gz
|
debian-i386 also failed with the same errors. Maybe this change does not work on 32 bit machines. |
No description provided.