String#* returns incorrect class when used with String subclasses
-----------------------------------------------------------------
Key: JRUBY-1752
URL: http://jira.codehaus.org/browse/JRUBY-1752
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Environment: Latest JRuby 1.1b1 from trunk
Reporter: Vladimir Sizikov
Attachments: string-multiply-subclass.patch
Consider the following example:
{noformat}
class MyString < String; end
(MyString.new("cool") * 0).class
{noformat}
MRI returns MyString.
JRuby returts String.
This also leads to one rubinius spec failure:
17)
String#* returns subclass instances FAILED
Expected String to equal MyString:
./mspec/expectations.rb:10:in `fail_with'
./mspec/matchers/base.rb:8:in `=='
/opt/work/rubinius/./spec/core/string/multiply_spec.rb:35:in `=='
/opt/work/rubinius/./spec/core/string/multiply_spec.rb:34:in `instance_eval'
./mspec/runner/runner.rb:121:in `describe'
./mspec/runner/object.rb:11:in `each'
./mspec/runner/runner.rb:115:in `describe'
./mspec/runner/object.rb:11:in `describe'
/opt/work/rubinius/./spec/core/string/multiply_spec.rb:4:in `describe'
/opt/work/rubinius/./spec/core/string/multiply_spec.rb:4:in `load'
tmp/last_mspec.rb:15:in `load'
tmp/last_mspec.rb:1:in `each'
tmp/last_mspec.rb:9:in `each'
The proposed patch (includes regression test) corrects the problem and rubinius
spce failure.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email