Issue #9344 has been updated by Sam Rawlins.

File 9344.patch added

This also applies to redundant repeat operator: `z = /[a-z]** foo/` because both these warnings use the older warning, `onig_verb_warn`. I think this warning method can be considered defunct. If we switch these two warnings to instead use `onig_syntax_warn`, the bug is fixed. These are also the last two references to `onig_verb_warn`, so the definition can be deleted as well.

Attached is a patch, although as I understand it, this will actually need to be applied to Onigmo [1], _then_ merged into Ruby. So I've also duplicated this issue at Onigmo [2].

[1] https://github.com/k-takata/Onigmo
[2] https://github.com/k-takata/Onigmo/issues/31

----------------------------------------
Bug #9344: warning origin incorrect with instance_eval
https://bugs.ruby-lang.org/issues/9344#change-45610

* Author: Thierry Lambert
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
File 'test.rb' contains:
  $-w = 2
  code = <<-RUBY
    x = /]]/
    y = /[a-z]+*/
  RUBY
  instance_eval code, 'foo.rb'

The execution reports:
  foo.rb:1: warning: regular expression has ']' without escape: /]]/
  test.rb:6: warning: nested repeat operator + and * was replaced with '*': /[a-z]+*/

The last line should state 'foo.rb:2' instead of 'test.rb:6'.

The bug is also present in: ruby 2.0.0p353 (2013-11-22) [i386-mingw32]


---Files--------------------------------
9344.patch (3.55 KB)


-- 
http://bugs.ruby-lang.org/