Forum: Ruby-core [ruby-trunk - Bug #7471][Open] character class has duplicated range warning for "" =~ /[\w\W]/

Posted by drbrain (Eric Hodel) (Guest)
on 2012-11-30 00:08
(Received via mailing list)
Issue #7471 has been reported by drbrain (Eric Hodel).

----------------------------------------
Bug #7471: character class has duplicated range warning for "" =~ 
/[\w\W]/
https://bugs.ruby-lang.org/issues/7471

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category: core
Target version: 2.0.0
ruby -v: -


=begin
The warning seems bogus, \w and \W do not overlap.

  $ cat test.rb
  $-w = true

  ""=~/[\w\W]/
  $ make runruby
  /Users/drbrain/Work/svn/ruby/trunk/test.rb:3: warning: character class 
has duplicated range: /[\w\W]/

There is no warning with 1.9.3:

  $ ~/.multiruby/install/1.9.3-p194/bin/ruby -v test.rb
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
  [no output]

This affects abbrev.rb:

  /usr/local/lib/ruby/2.0.0/abbrev.rb:77: warning: character class has 
duplicated range: /[\w\W]\z/

=end
Posted by knu (Akinori MUSHA) (Guest)
on 2012-11-30 04:17
(Received via mailing list)
Issue #7471 has been updated by knu (Akinori MUSHA).

Assignee changed from usa (Usaku NAKAMURA) to knu (Akinori MUSHA)


----------------------------------------
Bug #7471: character class has duplicated range warning for "" =~ 
/[\w\W]/
https://bugs.ruby-lang.org/issues/7471#change-34185

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: knu (Akinori MUSHA)
Category: core
Target version: 2.0.0
ruby -v: -


=begin
The warning seems bogus, \w and \W do not overlap.

  $ cat test.rb
  $-w = true

  ""=~/[\w\W]/
  $ make runruby
  /Users/drbrain/Work/svn/ruby/trunk/test.rb:3: warning: character class 
has duplicated range: /[\w\W]/

There is no warning with 1.9.3:

  $ ~/.multiruby/install/1.9.3-p194/bin/ruby -v test.rb
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
  [no output]

This affects abbrev.rb:

  /usr/local/lib/ruby/2.0.0/abbrev.rb:77: warning: character class has 
duplicated range: /[\w\W]\z/

=end
Posted by knu (Akinori MUSHA) (Guest)
on 2012-11-30 05:04
(Received via mailing list)
Issue #7471 has been updated by knu (Akinori MUSHA).

Status changed from Closed to Open
Assignee changed from knu (Akinori MUSHA) to naruse (Yui NARUSE)

While I worked around this, the warning itself looks like a bug in our 
regexp engine (Onigmo?).
----------------------------------------
Bug #7471: character class has duplicated range warning for "" =~ 
/[\w\W]/
https://bugs.ruby-lang.org/issues/7471#change-34190

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: core
Target version: 2.0.0
ruby -v: -


=begin
The warning seems bogus, \w and \W do not overlap.

  $ cat test.rb
  $-w = true

  ""=~/[\w\W]/
  $ make runruby
  /Users/drbrain/Work/svn/ruby/trunk/test.rb:3: warning: character class 
has duplicated range: /[\w\W]/

There is no warning with 1.9.3:

  $ ~/.multiruby/install/1.9.3-p194/bin/ruby -v test.rb
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
  [no output]

This affects abbrev.rb:

  /usr/local/lib/ruby/2.0.0/abbrev.rb:77: warning: character class has 
duplicated range: /[\w\W]\z/

=end
Posted by knu (Akinori MUSHA) (Guest)
on 2012-12-14 08:49
(Received via mailing list)
Issue #7471 has been updated by knu (Akinori MUSHA).


Onigmo doesn't have the code for detecting duplication in character 
class, so this problem seems to be on our own.

I narrowed the problem down:

% ruby@2.0.0 -EUS-ASCII -W2 -e '/[\D]/=~""'
-e:1: warning: character class has duplicated range: /[\D]/
% ruby@2.0.0 -EUS-ASCII -W2 -e '/[\W]/=~""'
-e:1: warning: character class has duplicated range: /[\W]/

Looks like CTYPE + NOT = FAIL.
----------------------------------------
Bug #7471: character class has duplicated range warning for "" =~ 
/[\w\W]/
https://bugs.ruby-lang.org/issues/7471#change-34732

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: core
Target version: 2.0.0
ruby -v: -


=begin
The warning seems bogus, \w and \W do not overlap.

  $ cat test.rb
  $-w = true

  ""=~/[\w\W]/
  $ make runruby
  /Users/drbrain/Work/svn/ruby/trunk/test.rb:3: warning: character class 
has duplicated range: /[\w\W]/

There is no warning with 1.9.3:

  $ ~/.multiruby/install/1.9.3-p194/bin/ruby -v test.rb
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
  [no output]

This affects abbrev.rb:

  /usr/local/lib/ruby/2.0.0/abbrev.rb:77: warning: character class has 
duplicated range: /[\w\W]\z/

=end
Posted by usa (Usaku NAKAMURA) (Guest)
on 2012-12-21 14:23
(Received via mailing list)
Issue #7471 has been updated by usa (Usaku NAKAMURA).

Status changed from Open to Assigned


----------------------------------------
Bug #7471: character class has duplicated range warning for "" =~ 
/[\w\W]/
https://bugs.ruby-lang.org/issues/7471#change-34951

Author: drbrain (Eric Hodel)
Status: Assigned
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: core
Target version: 2.0.0
ruby -v: -


=begin
The warning seems bogus, \w and \W do not overlap.

  $ cat test.rb
  $-w = true

  ""=~/[\w\W]/
  $ make runruby
  /Users/drbrain/Work/svn/ruby/trunk/test.rb:3: warning: character class 
has duplicated range: /[\w\W]/

There is no warning with 1.9.3:

  $ ~/.multiruby/install/1.9.3-p194/bin/ruby -v test.rb
  ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
  [no output]

This affects abbrev.rb:

  /usr/local/lib/ruby/2.0.0/abbrev.rb:77: warning: character class has 
duplicated range: /[\w\W]\z/

=end
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.