Project

General

Profile

Actions

Bug #18180

closed

opt_newarray_min/max instructions ignore refined methods

Added by wanabe (_ wanabe) over 3 years ago. Updated about 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-09-20T10:07:58Z master cb8434563d) [x86_64-linux]
[ruby-core:105352]

Description

$ ./miniruby -ve 'module M; refine Array do; def max; :max; end; def min; :min; end; end; end; using M; p [1 + 0, 2, 3].max, [1 + 0, 2, 3].min'
ruby 3.1.0dev (2021-09-20T10:07:58Z master cb8434563d) [x86_64-linux]
3
1

I expected :max and :min to be returned.

If I avoid the opt_newarray_min/max instruction, the behavior will be as expected.

$ ./miniruby -ve 'module M; refine Array do; def max; :max; end; def min; :min; end; end; end; using M; p [1, 2, 3].max, [1, 2, 3].min'
ruby 3.1.0dev (2021-09-20T10:07:58Z master cb8434563d) [x86_64-linux]
:max
:min
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0