diff options
author | Jeremy Evans <code@jeremyevans.net> | 2020-09-22 09:40:45 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2020-09-22 12:04:48 -0700 |
commit | 179384a66862d5ef7413b6f4850b97d0becf4ec9 (patch) | |
tree | 32d0c29f05e3166b47d9f1b0741192c26635c584 /spec | |
parent | f3dddd77a925f576acb6abab9b37e8839f028412 (diff) | |
download | ruby-179384a66862d5ef7413b6f4850b97d0becf4ec9.tar.gz |
Revert "Prevent SystemStackError when calling super in module with activated refinement"
This reverts commit eeef16e190cdabc2ba474622720f8e3df7bac43b.
This also reverts the spec change.
Preventing the SystemStackError would be nice, but there is valid
code that the fix breaks, and it is probably more common than cases
that cause the SystemStackError.
Fixes [Bug #17182]
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/core/module/refine_spec.rb | 79 |
1 files changed, 20 insertions, 59 deletions
diff --git a/spec/ruby/core/module/refine_spec.rb b/spec/ruby/core/module/refine_spec.rb index cb50fcbce6..54217a9326 100644 --- a/spec/ruby/core/module/refine_spec.rb +++ b/spec/ruby/core/module/refine_spec.rb @@ -980,77 +980,38 @@ describe "Module#refine" do result.should == [:B, :A, :LAST, :C] end - ruby_version_is ""..."3.0" do - it "looks in the lexical scope refinements before other active refinements" do - refined_class = ModuleSpecs.build_refined_class(for_super: true) - - refinement_local = Module.new do - refine refined_class do - def foo - [:LOCAL] + super - end - end - end - - a = Module.new do - using refinement_local + it "looks in the lexical scope refinements before other active refinements" do + refined_class = ModuleSpecs.build_refined_class(for_super: true) + refinement_local = Module.new do + refine refined_class do def foo - [:A] + super + [:LOCAL] + super end end - - refinement = Module.new do - refine refined_class do - include a - end - end - - result = nil - Module.new do - using refinement - result = refined_class.new.foo - end - - result.should == [:A, :LOCAL, :C] end - end - - ruby_version_is "3.0" do - # https://bugs.ruby-lang.org/issues/17007 - it "does not look in the lexical scope refinements before other active refinements" do - refined_class = ModuleSpecs.build_refined_class(for_super: true) - refinement_local = Module.new do - refine refined_class do - def foo - [:LOCAL] + super - end - end - end - - a = Module.new do - using refinement_local - - def foo - [:A] + super - end - end + a = Module.new do + using refinement_local - refinement = Module.new do - refine refined_class do - include a - end + def foo + [:A] + super end + end - result = nil - Module.new do - using refinement - result = refined_class.new.foo + refinement = Module.new do + refine refined_class do + include a end + end - result.should == [:A, :C] + result = nil + Module.new do + using refinement + result = refined_class.new.foo end + + result.should == [:A, :LOCAL, :C] end end |