Actions
Bug #18180
closedopt_newarray_min/max instructions ignore refined methods
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-09-20T10:07:58Z master cb8434563d) [x86_64-linux]
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
Like0
Like0Like0Like0