3.4-dev で `RubyVM::InstructionSequence.compile` 関連のバグ報告

2024/09/15に公開

[Bug #20741] RubyVM::InstructionSequence.compile emits a wrong warning (prism?)

  • 3.4-dev で RubyVM::InstructionSequence.compile で意図しない警告がでているというバグ報告
$ RBENV_VERSION=3.4-dev ruby -we 'p RubyVM::InstructionSequence.compile("42").eval'
<compiled>:1: warning: possibly useless use of a literal in void context
$ RBENV_VERSION=3.4-dev ruby --parser=parse.y -we 'p RubyVM::InstructionSequence.compile("42").eval'
42
$ RBENV_VERSION=3.4-dev ruby --parser=prism -we 'p RubyVM::InstructionSequence.compile("42").eval'
<compiled>:1: warning: possibly useless use of a literal in void context
42
  • ちなみに warning: possibly useless use of a literal in void context は『参照されてないリテラルがある』と出る警告です
$ RBENV_VERSION=3.3.4 ruby -we '42'
-e:1: warning: possibly useless use of a literal in void context
GitHubで編集を提案

Discussion