jerryscript-project / jerryscript

Ultra-lightweight JavaScript engine for the Internet of Things.
https://jerryscript.net
Apache License 2.0
6.89k stars 669 forks source link

Array concatenation exception #4995

Closed YiWen-y closed 1 year ago

YiWen-y commented 2 years ago
Version

Version: 3.0.0 (fea10bb7)

Execution steps
/.jsvu/jerry Testcase.js
Test case 1
var foo = function(it) {
    var a = [...it, , ];
    print(a);
    print(a.length);
};
var Parameter0 = [1, 2];
foo(Parameter0);
Output 1
1,2
2
Expected behavior
1,2,
3
Test case 2
var foo = function(it) {
    var arr = [ , ];
    var a = it.concat(arr);
    print(a);
    print(a.length);
};
var Parameter0 = [1, 2];
foo(Parameter0);
Output 2
1,2,
3
Description

I tested on multiple JS engines, test case 1 and test case 2 have the same semantics, they should have the same output. But jerry outputs abnormal results when executing test case 1.

YiWen-y commented 1 year ago

The author replied in Array concatenation exception #5026