Project

General

Profile

Bug #7471

character class has duplicated range warning for "" =~ /[\w\W]/

Added by drbrain (Eric Hodel) over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:50344]

Description

=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

Associated revisions

Revision 38028
Added by knu (Akinori MUSHA) over 4 years ago

Stop using a regexp that causes a false warning.

  • lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a false warning. [Bug #7471]

Revision 38028
Added by knu (Akinori MUSHA) over 4 years ago

Stop using a regexp that causes a false warning.

  • lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a false warning. [Bug #7471]

Revision 38028
Added by knu (Akinori MUSHA) over 4 years ago

Stop using a regexp that causes a false warning.

  • lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a false warning. [Bug #7471]

Revision 38028
Added by knu (Akinori MUSHA) over 4 years ago

Stop using a regexp that causes a false warning.

  • lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a false warning. [Bug #7471]

Revision 38805
Added by naruse (Yui NARUSE) about 4 years ago

  • regparse.c (add_ctype_to_cc): don't check dup warn on adding negative ctype to cclass. [Bug #7471]

Revision 38805
Added by naruse (Yui NARUSE) about 4 years ago

  • regparse.c (add_ctype_to_cc): don't check dup warn on adding negative ctype to cclass. [Bug #7471]

Revision 38805
Added by naruse (Yui NARUSE) about 4 years ago

  • regparse.c (add_ctype_to_cc): don't check dup warn on adding negative ctype to cclass. [Bug #7471]

Revision 38805
Added by naruse (Yui NARUSE) about 4 years ago

  • regparse.c (add_ctype_to_cc): don't check dup warn on adding negative ctype to cclass. [Bug #7471]

History

#1 [ruby-core:50366] Updated by knu (Akinori MUSHA) over 4 years ago

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

#2 Updated by knu (Akinori MUSHA) over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38028.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


Stop using a regexp that causes a false warning.

  • lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a false warning. [Bug #7471]

#3 [ruby-core:50369] Updated by knu (Akinori MUSHA) over 4 years ago

  • 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?).

#4 [ruby-core:50889] Updated by knu (Akinori MUSHA) over 4 years ago

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.

#5 [ruby-core:51045] Updated by usa (Usaku NAKAMURA) over 4 years ago

  • Status changed from Open to Assigned

#6 Updated by naruse (Yui NARUSE) about 4 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r38805.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • regparse.c (add_ctype_to_cc): don't check dup warn on adding negative ctype to cclass. [Bug #7471]

Also available in: Atom PDF