diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-05-20 18:52:32 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-05-21 12:12:31 -0400 |
commit | 636d4f7eb9f3fcb088e1a44af4181c4aa36789b4 (patch) | |
tree | 740452cda5e1c16efd05d7da2e31b924c5cb8922 /test/ruby | |
parent | 50a534a1526e2b9f4ea41e44b802bd73f9cebbeb (diff) |
Avoid setting the visibility of refinement method entries
Since refinement search is always performed, these entries should always
be public. The method entry that the refinement search returns decides
the visibility.
Fixes [Bug #17822]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4515
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_refinement.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index 50f0333c2c..14c112f344 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -2537,6 +2537,28 @@ class TestRefinement < Test::Unit::TestCase assert_equal(:second, klass.new.foo) end + class Bug17822 + module Ext + refine(Bug17822) do + def foo = :refined + end + end + + private(def foo = :not_refined) + + module Client + using Ext + def self.call_foo + Bug17822.new.foo + end + end + end + + # [Bug #17822] + def test_privatizing_refined_method + assert_equal(:refined, Bug17822::Client.call_foo) + end + private def eval_using(mod, s) |