From: "wanabe (_ wanabe)" Date: 2021-09-20T13:36:30+00:00 Subject: [ruby-core:105352] [Ruby master Bug#18180] opt_newarray_min/max instructions ignore refined methods Issue #18180 has been reported by wanabe (_ wanabe). ---------------------------------------- Bug #18180: opt_newarray_min/max instructions ignore refined methods https://bugs.ruby-lang.org/issues/18180 * Author: wanabe (_ wanabe) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- ``` $ ./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 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: