Closed Bug 169830 Opened 22 years ago Closed 22 years ago

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

Categories

(Rhino Graveyard :: Core, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: pschwartau, Assigned: norrisboyd)

Details

Attachments

(1 file)

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 () {
}
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 -
Committed as the patch passed the testsuite.
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 -
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...

Igor: thanks; let me mark this as FIXED, then -
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Marking Verified FIXED -
Status: RESOLVED → VERIFIED
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.

Attachment

General

Creator:
Created:
Updated:
Size: