Status: Assigned
Owner: [email protected]
Labels: Type-Bug Priority-Medium Harmony Area-Language

New issue 4316 by [email protected]: Array.prototype.concat always creates Arrays
https://code.google.com/p/v8/issues/detail?id=4316

Array.prototype.concat seems to be implemented as per ES5, not ES2015--it creates arrays, rather than making an instance of the (species of the) constructor of the receiver. For example,

d8> Array.prototype.concat.call(new Uint8Array([1, 2]), 3)
[1,2, 3]

The first element of that is 1,2, a TypedArray, and the second is 3. It is in an Array. However, the result should actually be throwing a TypeError.
http://ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat
22.1.3.1 step 7.d.v.4.c calls CreateDataPropertyOrThrow, which will fail on a TypedArray. A TypedArray should be created rather than an array based on step 3 which calls ArraySpeciesCreate based on the receiver, and that will create a zero-length TypedArray. Integer Indexed Exotic Objects do not allow new numerically indexed properties to be created.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to