ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
@ 2013-09-26  7:05 gfx (Goro Fuji)
  2013-09-26  7:20 ` [ruby-core:57386] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: gfx (Goro Fuji) @ 2013-09-26  7:05 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been reported by gfx (Goro Fuji).

----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953

Author: gfx (Goro Fuji)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57386] [ruby-trunk - Bug #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
@ 2013-09-26  7:20 ` sorah (Shota Fukumori)
  2013-09-26  7:46 ` [ruby-core:57387] [ruby-trunk - Bug #8953][Open] " sorah (Shota Fukumori)
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: sorah (Shota Fukumori) @ 2013-09-26  7:20 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by sorah (Shota Fukumori).


hm...

ruby  -e'class Regexp; def =~(o); true; end; end; p /a/ =~ "b"' #=> nil
----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-41988

Author: gfx (Goro Fuji)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57387] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
  2013-09-26  7:20 ` [ruby-core:57386] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
@ 2013-09-26  7:46 ` sorah (Shota Fukumori)
  2013-09-26  7:46 ` [ruby-core:57388] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: sorah (Shota Fukumori) @ 2013-09-26  7:46 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by sorah (Shota Fukumori).

Status changed from Closed to Open
% Done changed from 100 to 50

The problem still exists for opt_regexpmatch1, right?
----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-41990

Author: gfx (Goro Fuji)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57388] [ruby-trunk - Bug #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
  2013-09-26  7:20 ` [ruby-core:57386] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
  2013-09-26  7:46 ` [ruby-core:57387] [ruby-trunk - Bug #8953][Open] " sorah (Shota Fukumori)
@ 2013-09-26  7:46 ` sorah (Shota Fukumori)
  2013-09-26  7:48 ` [ruby-core:57389] " charliesome (Charlie Somerville)
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: sorah (Shota Fukumori) @ 2013-09-26  7:46 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by sorah (Shota Fukumori).


>The problem still exists for opt_regexpmatch1, right?

s/opt_regexpmatch1/opt_regexpmatch2/
----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-41991

Author: gfx (Goro Fuji)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57389] [ruby-trunk - Bug #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
                   ` (2 preceding siblings ...)
  2013-09-26  7:46 ` [ruby-core:57388] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
@ 2013-09-26  7:48 ` charliesome (Charlie Somerville)
  2013-09-26  7:52 ` [ruby-core:57390] [ruby-trunk - Bug #8953][Assigned] " sorah (Shota Fukumori)
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: charliesome (Charlie Somerville) @ 2013-09-26  7:48 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by charliesome (Charlie Somerville).


Ah you are right. Thanks for pointing that out sorah.
----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-41992

Author: gfx (Goro Fuji)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57390] [ruby-trunk - Bug #8953][Assigned] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
                   ` (3 preceding siblings ...)
  2013-09-26  7:48 ` [ruby-core:57389] " charliesome (Charlie Somerville)
@ 2013-09-26  7:52 ` sorah (Shota Fukumori)
  2013-09-26  7:59 ` [ruby-core:57391] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: sorah (Shota Fukumori) @ 2013-09-26  7:52 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by sorah (Shota Fukumori).

Status changed from Open to Assigned
Assignee set to sorah (Shota Fukumori)

Testing my patch on my machine for regexpmatch2
----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-41993

Author: gfx (Goro Fuji)
Status: Assigned
Priority: Normal
Assignee: sorah (Shota Fukumori)
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57391] [ruby-trunk - Bug #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
                   ` (4 preceding siblings ...)
  2013-09-26  7:52 ` [ruby-core:57390] [ruby-trunk - Bug #8953][Assigned] " sorah (Shota Fukumori)
@ 2013-09-26  7:59 ` sorah (Shota Fukumori)
  2013-09-26 16:13 ` [ruby-core:57405] [Backport 200 - Backport " ko1 (Koichi Sasada)
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: sorah (Shota Fukumori) @ 2013-09-26  7:59 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by sorah (Shota Fukumori).

Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: UNKNOWN, 2.0.0: REQUIRED

Please backport r43050, 43052
----------------------------------------
Bug #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-41995

Author: gfx (Goro Fuji)
Status: Closed
Priority: Normal
Assignee: sorah (Shota Fukumori)
Category: 
Target version: 
ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: REQUIRED


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57405] [Backport 200 - Backport #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
                   ` (5 preceding siblings ...)
  2013-09-26  7:59 ` [ruby-core:57391] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
@ 2013-09-26 16:13 ` ko1 (Koichi Sasada)
  2013-09-26 16:17   ` [ruby-core:57406] " SASADA Koichi
  2013-09-26 16:51   ` [ruby-core:57407] " Tanaka Akira
  2013-10-01  9:04 ` [ruby-core:57540] [ruby-trunk - Feature " ko1 (Koichi Sasada)
  2014-01-30  6:17 ` [ruby-core:60332] " shibata.hiroshi
  8 siblings, 2 replies; 12+ messages in thread
From: ko1 (Koichi Sasada) @ 2013-09-26 16:13 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by ko1 (Koichi Sasada).


I checked previous behavior.

versions/install-tags_v1_6_5_/bin/ruby
versions/install-tags_v1_6_6_/bin/ruby
versions/install-tags_v1_6_7_/bin/ruby
versions/install-tags_v1_6_8_/bin/ruby
versions/install-tags_v1_8_5_/bin/ruby
versions/install-tags_v1_8_5_113_/bin/ruby
versions/install-tags_v1_8_5_114_/bin/ruby
versions/install-tags_v1_8_5_115_/bin/ruby
versions/install-tags_v1_8_5_11_/bin/ruby
versions/install-tags_v1_8_5_12_/bin/ruby
versions/install-tags_v1_8_5_231_/bin/ruby
versions/install-tags_v1_8_5_2_/bin/ruby
versions/install-tags_v1_8_5_35_/bin/ruby
versions/install-tags_v1_8_5_52_/bin/ruby
versions/install-tags_v1_8_5_preview1_/bin/ruby
versions/install-tags_v1_8_5_preview2_/bin/ruby
versions/install-tags_v1_8_5_preview3_/bin/ruby
versions/install-tags_v1_8_5_preview4_/bin/ruby
versions/install-tags_v1_8_5_preview5_/bin/ruby
versions/install-tags_v1_8_6_/bin/ruby
versions/install-tags_v1_8_6_110_/bin/ruby
versions/install-tags_v1_8_6_111_/bin/ruby
versions/install-tags_v1_8_6_114_/bin/ruby
versions/install-tags_v1_8_6_230_/bin/ruby
versions/install-tags_v1_8_6_286_/bin/ruby
versions/install-tags_v1_8_6_287_/bin/ruby
versions/install-tags_v1_8_6_368_/bin/ruby
versions/install-tags_v1_8_6_369_/bin/ruby
versions/install-tags_v1_8_6_36_/bin/ruby
versions/install-tags_v1_8_6_383_/bin/ruby
versions/install-tags_v1_8_6_388_/bin/ruby
versions/install-tags_v1_8_6_398_/bin/ruby
versions/install-tags_v1_8_6_399_/bin/ruby
versions/install-tags_v1_8_6_420_/bin/ruby
versions/install-tags_v1_8_6_preview1_/bin/ruby
versions/install-tags_v1_8_6_preview2_/bin/ruby
versions/install-tags_v1_8_6_preview3_/bin/ruby
versions/install-tags_v1_8_7_/bin/ruby
versions/install-tags_v1_8_7_160_/bin/ruby
versions/install-tags_v1_8_7_173_/bin/ruby
versions/install-tags_v1_8_7_174_/bin/ruby
versions/install-tags_v1_8_7_17_/bin/ruby
versions/install-tags_v1_8_7_22_/bin/ruby
versions/install-tags_v1_8_7_248_/bin/ruby
versions/install-tags_v1_8_7_249_/bin/ruby
versions/install-tags_v1_8_7_299_/bin/ruby
versions/install-tags_v1_8_7_301_/bin/ruby
versions/install-tags_v1_8_7_302_/bin/ruby
versions/install-tags_v1_8_7_330_/bin/ruby
versions/install-tags_v1_8_7_334_/bin/ruby
versions/install-tags_v1_8_7_352_/bin/ruby
versions/install-tags_v1_8_7_357_/bin/ruby
versions/install-tags_v1_8_7_358_/bin/ruby
versions/install-tags_v1_8_7_369_/bin/ruby
versions/install-tags_v1_8_7_370_/bin/ruby
versions/install-tags_v1_8_7_371_/bin/ruby
versions/install-tags_v1_8_7_373_/bin/ruby
versions/install-tags_v1_8_7_374_/bin/ruby
versions/install-tags_v1_8_7_71_/bin/ruby
versions/install-tags_v1_8_7_72_/bin/ruby
versions/install-tags_v1_8_7_preview1_/bin/ruby
versions/install-tags_v1_8_7_preview2_/bin/ruby
versions/install-tags_v1_8_7_preview3_/bin/ruby
versions/install-tags_v1_8_7_preview4_/bin/ruby
versions/install-tags_v1_9_0_0_/bin/ruby
versions/install-tags_v1_9_0_1_/bin/ruby
versions/install-tags_v1_9_0_2_/bin/ruby
versions/install-tags_v1_9_0_3_/bin/ruby
versions/install-tags_v1_9_0_4_/bin/ruby
versions/install-tags_v1_9_0_5_/bin/ruby
versions/install-tags_v1_9_1_0_/bin/ruby
versions/install-tags_v1_9_1_126_/bin/ruby
versions/install-tags_v1_9_1_127_/bin/ruby
versions/install-tags_v1_9_1_128_/bin/ruby
versions/install-tags_v1_9_1_129_/bin/ruby
versions/install-tags_v1_9_1_243_/bin/ruby
versions/install-tags_v1_9_1_376_/bin/ruby
versions/install-tags_v1_9_1_378_/bin/ruby
versions/install-tags_v1_9_1_429_/bin/ruby
versions/install-tags_v1_9_1_430_/bin/ruby
versions/install-tags_v1_9_1_431_/bin/ruby
versions/install-tags_v1_9_1_preview1_/bin/ruby
versions/install-tags_v1_9_1_preview2_/bin/ruby
versions/install-tags_v1_9_1_rc1_/bin/ruby
versions/install-tags_v1_9_1_rc2_/bin/ruby
versions/install-tags_v1_9_2_0_/bin/ruby
versions/install-tags_v1_9_2_136_/bin/ruby
versions/install-tags_v1_9_2_180_/bin/ruby
versions/install-tags_v1_9_2_290_/bin/ruby
versions/install-tags_v1_9_2_318_/bin/ruby
versions/install-tags_v1_9_2_320_/bin/ruby
versions/install-tags_v1_9_2_preview1_/bin/ruby
versions/install-tags_v1_9_2_preview2_/bin/ruby
versions/install-tags_v1_9_2_preview3_/bin/ruby
versions/install-tags_v1_9_2_rc1_/bin/ruby
versions/install-tags_v1_9_2_rc2_/bin/ruby
versions/install-tags_v1_9_3_0_/bin/ruby
versions/install-tags_v1_9_3_125_/bin/ruby
versions/install-tags_v1_9_3_194_/bin/ruby
versions/install-tags_v1_9_3_195_/bin/ruby
versions/install-tags_v1_9_3_286_/bin/ruby
versions/install-tags_v1_9_3_327_/bin/ruby
versions/install-tags_v1_9_3_360_/bin/ruby
versions/install-tags_v1_9_3_362_/bin/ruby
versions/install-tags_v1_9_3_374_/bin/ruby
versions/install-tags_v1_9_3_385_/bin/ruby
versions/install-tags_v1_9_3_392_/bin/ruby
versions/install-tags_v1_9_3_429_/bin/ruby
versions/install-tags_v1_9_3_448_/bin/ruby
versions/install-tags_v1_9_3_preview1_/bin/ruby
versions/install-tags_v1_9_3_rc1_/bin/ruby
versions/install-tags_v2_0_0_0_/bin/ruby
versions/install-tags_v2_0_0_195_/bin/ruby
versions/install-tags_v2_0_0_247_/bin/ruby
versions/install-tags_v2_0_0_preview1_/bin/ruby
versions/install-tags_v2_0_0_preview2_/bin/ruby
versions/install-tags_v2_0_0_rc1_/bin/ruby
versions/install-tags_v2_0_0_rc2_/bin/ruby

And all of versions ignore the redefinition.
I implemented 1.9 VM as this behaviour because I think it is spec.

Could you ask matz?

----------------------------------------
Backport #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-42013

Author: gfx (Goro Fuji)
Status: Assigned
Priority: Normal
Assignee: nagachika (Tomoyuki Chikanaga)
Category: 
Target version: 


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57406] Re: [Backport 200 - Backport #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26 16:13 ` [ruby-core:57405] [Backport 200 - Backport " ko1 (Koichi Sasada)
@ 2013-09-26 16:17   ` SASADA Koichi
  2013-09-26 16:51   ` [ruby-core:57407] " Tanaka Akira
  1 sibling, 0 replies; 12+ messages in thread
From: SASADA Koichi @ 2013-09-26 16:17 UTC (permalink / raw
  To: ruby-core

(2013/09/27 1:13), ko1 (Koichi Sasada) wrote:
> And all of versions ignore the redefinition.
> I implemented 1.9 VM as this behaviour because I think it is spec.
> 
> Could you ask matz?

I have no objection about that.
However, please be more careful to change the behavior.
(this phrase is also for me, of course)

-- 
// SASADA Koichi at atdot dot net

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57407] Re: [Backport 200 - Backport #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26 16:13 ` [ruby-core:57405] [Backport 200 - Backport " ko1 (Koichi Sasada)
  2013-09-26 16:17   ` [ruby-core:57406] " SASADA Koichi
@ 2013-09-26 16:51   ` Tanaka Akira
  1 sibling, 0 replies; 12+ messages in thread
From: Tanaka Akira @ 2013-09-26 16:51 UTC (permalink / raw
  To: Ruby developers

2013/9/27 ko1 (Koichi Sasada) <redmine@ruby-lang.org>:
> Issue #8953 has been updated by ko1 (Koichi Sasada).

> And all of versions ignore the redefinition.
> I implemented 1.9 VM as this behaviour because I think it is spec.

I also think so.
The spec is one of the reason Ruby can assign named capture to local variable.

% ruby -e '/def(?<var>.*)/ =~ "abcdefghi"; p var'
"ghi"
-- 
Tanaka Akira

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:57540] [ruby-trunk - Feature #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
                   ` (6 preceding siblings ...)
  2013-09-26 16:13 ` [ruby-core:57405] [Backport 200 - Backport " ko1 (Koichi Sasada)
@ 2013-10-01  9:04 ` ko1 (Koichi Sasada)
  2014-01-30  6:17 ` [ruby-core:60332] " shibata.hiroshi
  8 siblings, 0 replies; 12+ messages in thread
From: ko1 (Koichi Sasada) @ 2013-10-01  9:04 UTC (permalink / raw
  To: ruby-core


Issue #8953 has been updated by ko1 (Koichi Sasada).

Category set to core
Assignee changed from charliesome (Charlie Somerville) to matz (Yukihiro Matsumoto)
Target version set to current: 2.1.0

Could you check it?
----------------------------------------
Feature #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-42154

Author: gfx (Goro Fuji)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: current: 2.1.0


The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String



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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:60332] [ruby-trunk - Feature #8953] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
  2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
                   ` (7 preceding siblings ...)
  2013-10-01  9:04 ` [ruby-core:57540] [ruby-trunk - Feature " ko1 (Koichi Sasada)
@ 2014-01-30  6:17 ` shibata.hiroshi
  8 siblings, 0 replies; 12+ messages in thread
From: shibata.hiroshi @ 2014-01-30  6:17 UTC (permalink / raw
  To: ruby-core

Issue #8953 has been updated by Hiroshi SHIBATA.

Target version changed from 2.1.0 to current: 2.2.0

----------------------------------------
Feature #8953: `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal
https://bugs.ruby-lang.org/issues/8953#change-44802

* Author: Goro Fuji
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: core
* Target version: current: 2.2.0
----------------------------------------
The expression `a =~ b` does not call the =~ method in some cases.
I think it is a bug that results from optimizations.

See the following code for details:

Code that does not work as expected (shows nothing):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # does nothing

Code that works as expected (raises errors):

$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s.=~ /foo/' # call =~ as a method
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end;  s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end;  s =~ /foo/' # LHS is not a String




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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-01-30  6:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26  7:05 [ruby-core:57385] [ruby-trunk - Bug #8953][Open] `str =~ /pattern/` does not call =~ method if (1) str is a String, (2) /pattern/ is a Regexp literal gfx (Goro Fuji)
2013-09-26  7:20 ` [ruby-core:57386] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
2013-09-26  7:46 ` [ruby-core:57387] [ruby-trunk - Bug #8953][Open] " sorah (Shota Fukumori)
2013-09-26  7:46 ` [ruby-core:57388] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
2013-09-26  7:48 ` [ruby-core:57389] " charliesome (Charlie Somerville)
2013-09-26  7:52 ` [ruby-core:57390] [ruby-trunk - Bug #8953][Assigned] " sorah (Shota Fukumori)
2013-09-26  7:59 ` [ruby-core:57391] [ruby-trunk - Bug #8953] " sorah (Shota Fukumori)
2013-09-26 16:13 ` [ruby-core:57405] [Backport 200 - Backport " ko1 (Koichi Sasada)
2013-09-26 16:17   ` [ruby-core:57406] " SASADA Koichi
2013-09-26 16:51   ` [ruby-core:57407] " Tanaka Akira
2013-10-01  9:04 ` [ruby-core:57540] [ruby-trunk - Feature " ko1 (Koichi Sasada)
2014-01-30  6:17 ` [ruby-core:60332] " shibata.hiroshi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).