Age | Commit message (Collapse) | Author |
|
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]
---
test/ruby/test_refinement.rb | 22 ++++++++++++++++++++++
vm_method.c | 15 ++++++++++-----
2 files changed, 32 insertions(+), 5 deletions(-)
|
|
Method cache: fix refinement entry handling
To invalidate some callable method entries, we replace the entry in the
class. Most types of method entries are on the method table of the
origin class, but refinement entries without an orig_me are housed in
the method table of the class itself. They are there because refinements
take priority over prepended methods.
By unconditionally inserting a copy of the refinement entry into the
origin class, clearing the method cache created situations where there
are refinement entry duplicates in the lookup chain, leading to infinite
loops and other problems.
Update the replacement logic to use the right class that houses the
method entry. Also, be more selective about cache invalidation when
moving refinement entries for prepend. This avoids calling
clear_method_cache_by_id_in_class() before refinement entries are in the
place it expects.
[Bug #17806]
---
class.c | 4 +++-
test/ruby/test_refinement.rb | 49 ++++++++++++++++++++++++++++++++++++++++++++
vm_method.c | 13 ++++++++++--
3 files changed, 63 insertions(+), 3 deletions(-)
|
|
cee02d754d76563635c1db90d2ab6c01f8492470 resets pCMC and `me`
will be a invalidated and continuing the invalidated `me`,
it will break the data structure. This patch tris to clear
all methods of specified class before manipulating the `me`s.
[Issue #17417]
Notes:
Merged: https://github.com/ruby/ruby/pull/3964
|
|
replaced method entry should be invalidated.
[Bug #17386]
|
|
Instead of suppressing all warnings wholly in each test scripts by
setting `$VERBOSE` to `nil` in `setup` methods.
Notes:
Merged: https://github.com/ruby/ruby/pull/3925
Merged-By: nobu <nobu@ruby-lang.org>
|
|
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]
Notes:
Merged: https://github.com/ruby/ruby/pull/3564
|
|
Without this, if a refinement defines a method that calls super and
includes a module with a module that calls super and has a activated
refinement at the point super is called, the module method super call
will end up calling back into the refinement method, creating a loop.
Fixes [Bug #17007]
Notes:
Merged: https://github.com/ruby/ruby/pull/3309
|
|
http://rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20200619T003004Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20200619T003004Z/ruby/test/ruby/test_refinement.rb:2428: warning: method redefined; discarding old foo
/home/chkbuild/chkbuild/tmp/build/20200619T003004Z/ruby/test/ruby/test_refinement.rb:2418: warning: previous definition of foo was here
```
|
|
Doing so modifies the class's method table, but not in a way that should
be detectable from Ruby, so it may be safe to avoid checking if the
class is frozen.
Fixes [Bug #11669]
Notes:
Merged: https://github.com/ruby/ruby/pull/3175
|
|
https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian-riscv64/ruby-master/log/20200420T083601Z.fail.html.gz
|
|
|
|
|
|
Give up to support multi-run:
* test_method_should_use_refinements
* test_instance_method_should_use_refinements
I hope someone can revisit it.
|
|
After the previous commit, this was still broken. The reason it
was broken is that a refined module that hasn't been prepended to
yet keeps the refined methods in the module's method table. When
prepending, the module's method table is moved to the origin
iclass, and then the refined methods are moved from the method
table to a new method table in the module itself.
Unfortunately, that means that if a class has included the module,
prepending breaks the refinements, because when the methods are
moved from the origin iclass method table to the module method
table, they are removed from the method table from the iclass
created when the module was included earlier.
Fix this by always creating an origin class when including a
module that has any refinements, even if the refinements are
not currently used. I wasn't sure the best way to do that.
The approach I choose was to use an object flag. The flag is
set on the module when Module#refine is called, and if the
flag is present when the module is included in another module
or class, an origin iclass is created for the module.
Fixes [Bug #13446]
Notes:
Merged: https://github.com/ruby/ruby/pull/2550
|
|
This previously did not work, and the reason it did not work is
that:
1) Refining a module or class that prepends other modules places
the refinements in the class itself and not the origin iclass.
2) Inclusion of a module that prepends other modules skips the
module itself, including only iclasses for the prepended modules
and the origin iclass.
Those two behaviors combined meant that the method table for the
refined methods for the included module never ends up in the
method lookup chain for the class including the module.
Fix this by not skipping the module itself when the module is
included. This requires some code rearranging in
rb_include_class_new to make sure the correct method tables and
origin settings are used for the created iclass.
As origin iclasses shouldn't be exposed to Ruby, this also
requires skipping modules that have origin iclasses in
Module#ancestors (classes that have origin iclasses were already
skipped).
Fixes [Bug #16242]
Notes:
Merged: https://github.com/ruby/ruby/pull/2550
|
|
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
Notes:
Merged: https://github.com/ruby/ruby/pull/2476
|
|
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b.
[Feature #16275]
|
|
This makes it consistent with calling private attribute assignment
methods, which currently is allowed (e.g. `self.value =`).
Calling a private method in this way can be useful when trying to
assign the return value to a local variable with the same name.
[Feature #11297] [Feature #16123]
Notes:
Merged: https://github.com/ruby/ruby/pull/2474
|
|
[Bug #16107]
Notes:
Merged: https://github.com/ruby/ruby/pull/2373
|
|
|
|
Fixes [Bug #15720]
|
|
|
|
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[Fix GH-2034]
From: manga_osyo <manga.osyo@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
https://rubyci.org/logs/rubyci.s3.amazonaws.com/amazon/ruby-trunk/log/20181229T153003Z.fail.html.gz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[Feature #15327] [Fix GH-2020]
From: osyo-manga <manga.osyo@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[Feature #15326] [Fix GH-2019]
From: manga_osyo <manga.osyo@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_args.c (vm_to_proc): enable #to_proc by refinements at Proc
passing as a block. patched by osyo (manga osyo).
[Feature #14223]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_method.c (rb_method_entry_complement_defined_class): clone
the original method entry of refined module instance method with
the active ICLASS, to track super method chain.
[ruby-dev:50390] [Bug #14232]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
When refining a module, the module was set to the superclass of its refinement,
and a segmentation fault occurred.
The superclass of the refinement should be an iclass of the module.
[ruby-core:83617] [Bug #14070]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
Use rb_callable_method_entry_t::defined_class instead of
rb_callable_method_entry_t::owner, because the superclass of iclass
should be searched for modules. [ruby-core:83613] [Bug #14068]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/ruby/test_refinement.rb (test_dsym_literal): test for
r59946, interning dynamic symbol should not be affected by
refinements too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* eval.c (ignored_block): check argument type, which must be
Module. [ruby-dev:50270] [Bug #13956]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* compile.c (iseq_compile_each0): insert to_s method call, so that
refinements activated at the caller should take place.
[Feature #13812]
* insns.def (tostring): fix up converted object to a string,
infect and fallback.
* insns.def (branchiftype): new instruction for conversion.
branches if TOS is an instance of the given type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_method.c (rb_method_entry_make): suppress a warning at
refined method which will not be redefined.
[ruby-core:82385] [Bug #13817]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_insnhelper.c (vm_call_method_each_type): honor the original
visibility of inherited methods when a refinement is defined but
not activated. [ruby-core:82209] [Bug #13776]
Author: Mon_Ouie (Mon ouïe) <mon.ouie@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* class.c (ensure_includable): cannot include refinement
module, or the type and the class do not match.
[ruby-core:79632] [Bug #13236]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_args.c (refine_sym_proc_call): pass block to the method when
using refinements. [ruby-core:80219] [Bug #13325]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_insnhelper.c (vm_call_zsuper): method defined in module in
refinement is not callable as-is. dispatch again.
[ruby-core:79588] [Bug #13227]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_method.c (rb_undef): resolve the method entry which refines a
prepended method entry. [ruby-core:78944] [Bug #13096]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_insnhelper.c (vm_call_zsuper): prevent infinite recursion
zsuper in refinements. [ruby-core:77161] [Bug #12729]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_eval.c (vm_call0_body): refined module should not be skipped
as prepended. [ruby-core:78073] [Bug #12920]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
add a test to check that alias in subclasses can be refined.
[ruby-core:69374] [Bug #11186]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/ruby/test_refinement.rb (test_symbol_proc): a Symbol is
converted to a Proc in the caller's context. [Feature #9451]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* vm_insnhelper.c (vm_call_opt_send): enable refinements with
Kernel#send and BasicObject#__send__. [Feature #11476]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/ruby/test_refinement.rb (test_symbol_proc): move from
test_symbol.rb [Feature #9451]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* test/ruby/test_refinement.rb (FooExtClient, FooExtClient2): no
needs to eval, using works in a class block now.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[ruby-core:76199] [Feature #12534]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|