Node: Array.concat breaks when extending the Array to custom class using ES6 classes

Created on 13 Mar 2018  路  3Comments  路  Source: nodejs/node

  • Version: 8.9.3
  • Platform: Ubuntu 16.04 64-bit
class MyArray extends Array {};

let myArray = new MyArray(6);
myArray = myArray.concat(new MyArray(5));

let array = new Array(6);
array = array.concat(new Array(5));

console.log('myArray length: ', myArray.length);
console.log('array length: ', array.length);

Actual output:

myArray length:  0
array length:  11

Expected output:

myArray length:  11
array length:  11

FEW NOTES:

  • Actual and expected output match when run with node v10.0.0-pre
  • Actual and expected output match when run in the chrome V8 console
confirmed-bug

Most helpful comment

Looks like this was still broken in node v8.9.4 (v8 6.1.534.50) and fixed by node v8.10.0 (v8 6.2.414.50).

I haven't bisected it exactly but I guess this is the fix:
https://chromium-review.googlesource.com/c/v8/v8/+/636695
and this is the original bug:
https://bugs.chromium.org/p/v8/issues/detail?id=6708

All 3 comments

Seems to be fixed in v8.10.0, I'll close this.

I can reproduce this on macOS and Ubuntu 16.04.

@nodejs/v8 could you comment on whether this is a known fixed bug? It seems to be fixed in v8.10.0 so that's great, but would be good to have more info here for anyone else stuck on a previous 8.x version.

Looks like this was still broken in node v8.9.4 (v8 6.1.534.50) and fixed by node v8.10.0 (v8 6.2.414.50).

I haven't bisected it exactly but I guess this is the fix:
https://chromium-review.googlesource.com/c/v8/v8/+/636695
and this is the original bug:
https://bugs.chromium.org/p/v8/issues/detail?id=6708

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srl295 picture srl295  路  3Comments

cong88 picture cong88  路  3Comments

Brekmister picture Brekmister  路  3Comments

loretoparisi picture loretoparisi  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments