-
Bug
-
Resolution: Fixed
-
P3
-
9
-
None
-
b148
-
generic
-
generic
Because the boolean type is considered narrower than numeric types in Nashorn it is possible to invoke builtin specialized functions that accept numeric params with boolean arguments. In many cases this leads to the correct result as arguments are converted to numbers anyway, but in the case of Array.prototype.concat and Array.prototype.push the result is wrong.
var array = [].concat(true); // array is [1], should be [true]
array.push(false); // array is [1, 0], should be [true, false]
This only occurs with optimistic types enabled.
var array = [].concat(true); // array is [1], should be [true]
array.push(false); // array is [1, 0], should be [true, false]
This only occurs with optimistic types enabled.