Summary
Constructing a typed array from an array literal crashes in compiled mode (independent of destructuring):
const x = new Uint8Array([1, 2, 3]);
console.log(x[0], x.length);
Unhandled exception. System.InvalidCastException: Unable to cast object of type '$Array' to type 'System.IConvertible'.
at System.Convert.ToDouble(Object value)
at $Runtime.CreateUint8ArrayFromObject(Object)
at $Program.Main()
The interpreter runs it correctly. Compiled CreateUint8ArrayFromObject calls Convert.ToDouble on the whole $Array instead of iterating its elements. Compiled spread of a typed array is also unsupported (Spread expression must be an iterable type ... got 'Uint8Array').
Discovered
While implementing #753/#754 (testing typed-array rest destructuring). Pre-existing and independent — the repro uses neither destructuring nor spread. Blocks the compiled side of the typed-array-rest companion issue.
Summary
Constructing a typed array from an array literal crashes in compiled mode (independent of destructuring):
The interpreter runs it correctly. Compiled
CreateUint8ArrayFromObjectcallsConvert.ToDoubleon the whole$Arrayinstead of iterating its elements. Compiled spread of a typed array is also unsupported (Spread expression must be an iterable type ... got 'Uint8Array').Discovered
While implementing #753/#754 (testing typed-array rest destructuring). Pre-existing and independent — the repro uses neither destructuring nor spread. Blocks the compiled side of the typed-array-rest companion issue.