[ruby-core:115110] [Ruby master Bug#19966] Prism defines global method instead of singleton method

Issue #19966 has been reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Bug #19966: Prism defines global method instead of singleton method https://bugs.ruby-lang.org/issues/19966 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED ---------------------------------------- The receiver is ignored and compiled to `definemethod` instead of `definesmethod`. ``` $ ./ruby -v -e 'puts RubyVM::InstructionSequence.compile_prism("def a.foo;end").disasm' ruby 3.3.0dev (2023-10-20T00:12:09Z master 985370406d) [arm64-darwin22] == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,13)> 0000 definemethod :foo, foo 0003 putobject :foo 0005 leave == disasm: #<ISeq:foo@<compiled>:0 (0,0)-(0,13)> 0000 putnil 0001 leave ``` ``` $ ./ruby -v -e 'puts RubyVM::InstructionSequence.compile("def a.foo;end").disasm' ruby 3.3.0dev (2023-10-20T00:12:09Z master 985370406d) [arm64-darwin22] == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,13)> 0000 putself ( 1)[Li] 0001 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0003 definesmethod :foo, foo 0006 putobject :foo 0008 leave == disasm: #<ISeq:foo@<compiled>:1 (1,0)-(1,13)> 0000 putnil ( 1)[Ca] 0001 leave [Re] ``` -- https://bugs.ruby-lang.org/

Issue #19966 has been updated by nobu (Nobuyoshi Nakada). https://github.com/ruby/ruby/pull/8718 ---------------------------------------- Bug #19966: Prism defines global method instead of singleton method https://bugs.ruby-lang.org/issues/19966#change-105020 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED ---------------------------------------- The receiver is ignored and compiled to `definemethod` instead of `definesmethod`. ``` $ ./ruby -v -e 'puts RubyVM::InstructionSequence.compile_prism("def a.foo;end").disasm' ruby 3.3.0dev (2023-10-20T00:12:09Z master 985370406d) [arm64-darwin22] == disasm: #<ISeq:<compiled>@<compiled>:0 (0,0)-(0,13)> 0000 definemethod :foo, foo 0003 putobject :foo 0005 leave == disasm: #<ISeq:foo@<compiled>:0 (0,0)-(0,13)> 0000 putnil 0001 leave ``` ``` $ ./ruby -v -e 'puts RubyVM::InstructionSequence.compile("def a.foo;end").disasm' ruby 3.3.0dev (2023-10-20T00:12:09Z master 985370406d) [arm64-darwin22] == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,13)> 0000 putself ( 1)[Li] 0001 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0003 definesmethod :foo, foo 0006 putobject :foo 0008 leave == disasm: #<ISeq:foo@<compiled>:1 (1,0)-(1,13)> 0000 putnil ( 1)[Ca] 0001 leave [Re] ``` -- https://bugs.ruby-lang.org/
participants (1)
-
nobu (Nobuyoshi Nakada)