rbs/test: stack level too deep when calling super from prepend
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Description
Similar issue to #478 .
Example:
# test-attach.rb
class TestAttach
def attach
puts "attach 2"
end
module RegisterAttach
def attach
puts "attach 1"
super
end
end
prepend RegisterAttach
end
TestAttach.new.attach
# sig/test-attach.rbs
class TestAttach
def attach: () -> String
end
Run without rbs/test is OK:
$ ruby test-attach.rb
attach 1
attach 2
Run with rbs/test fails with stack level too deep:
$ RBS_TEST_TARGET='TestAttach' ruby -r rbs/test/setup test-attach.rb
[...]
attach 1
attach 1
/home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/type_check.rb:60:in `method_call': stack level too deep (SystemStackError)
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/type_check.rb:26:in `block in overloaded_call'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/type_check.rb:25:in `map'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/type_check.rb:25:in `overloaded_call'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/tester.rb:152:in `call'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/observer.rb:10:in `notify'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/hook.rb:178:in `ensure in attach__with__RBS_TEST_16c021_404c48f8'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/hook.rb:178:in `attach__with__RBS_TEST_16c021_404c48f8'
from test-attach.rb:9:in `attach'
... 7697 levels...
from test-attach.rb:9:in `attach'
from /home/lars/.rvm/gems/ruby-3.3.0/gems/rbs-3.4.1/lib/rbs/test/hook.rb:146:in `attach__with__RBS_TEST_16c021_404c48f8'
from test-attach.rb:9:in `attach'
from test-attach.rb:15:in `<main>'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with test-attach.rb, sig/test-attach.rbs, and the RBS_TEST_TARGET command shown in the issue. Then inspect lib/rbs/test/type_check.rb, tester.rb, observer.rb, and hook.rb around the stack trace to trace how prepend and super are hooked. Done means the example runs without recursive calls or SystemStackError and prints each attach message once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100