Array.concat(function) doesn't add function to the array

VERIFIED FIXED in 1.5R4

Status

Rhino
Core
VERIFIED FIXED
15 years ago
14 years ago

People

(Reporter: Phil Schwartau, Assigned: Norris Boyd)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
This is the Rhino version of bug 169795 against SpiderMonkey.
Other datatypes are being successfully pushed by Array.prototype.concat(),
but not function datatypes:

js> x = 'Hi';
Hi
js> [].concat(x);
Hi

js> x = 1;
1
js> [].concat(x);
1

js> x = {};
[object Object]
js> [].concat(x);
[object Object]


js> x = function() {}

function () {
}

js> [].concat(x);
                  <<<------------------- x WAS NOT PUSHED ONTO THE ARRAY !!!
js> [].concat(x).length;
0


By contrast, if we wrap the function object in an array,
Array.prototype.concat() will successfully push it:


js> x = function() {}

function () {
}

js> [].concat([x])

function () {
}
(Reporter)

Comment 1

15 years ago
The testcase for this bug is

      mozilla/js/tests/ecma_3/Array/15.4.4.4-001.js

Currently failing in both SpiderMonkey and Rhino -

Comment 2

15 years ago
Created attachment 100405 [details] [diff] [review]
Use ScriptRuntime.instanceOf instead of hasLengthProperty

Comment 3

15 years ago
Committed as the patch passed the testsuite.
(Reporter)

Comment 4

15 years ago
Igor: do you want to mark this as fixed?

I can verify the fix: the above testcase is now passing 
for me in the rhino and rhinoi shells on WinNT -

Comment 5

15 years ago
To Phil: I can not mark the bug as fixed since I do not have permissions to do
so. I changed my account e-mail to igor@icesoft.no as we got better anti-spam
software at work but now I realized that I lost a permission to alter bugs status...

(Reporter)

Comment 6

15 years ago
Igor: thanks; let me mark this as FIXED, then -
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
(Reporter)

Comment 7

15 years ago
Marking Verified FIXED -
Status: RESOLVED → VERIFIED

Comment 8

14 years ago
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.