Closed
Description
Hello,
Version: [email protected]
Story: I upgraded assemblyscript package to the last version and the code stops compiling. It does however with version 0.9.4
Summary: I went deeper and managed to find that extending an array returns a lot of errors on the compilation.
Code
export class MyArray extends Array<u8> { }
Compilation Log
ERROR AS202: Type 'i32' cannot be changed to type 'u8'.
store<T>(base + (<usize>lastIndex << alignof<T>()), changetype<T>(0));
~~~~~~~~~~~~~~~~
in ~lib/array.ts(370,57)
ERROR AS102: User-defined: "Cannot call flat() on Array<T> where T is not an Array."
ERROR("Cannot call flat() on Array<T> where T is not an Array.");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(499,7)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
size += child == 0 ? 0 : load<i32>(child, offsetof<T>("length_"));
~
in ~lib/array.ts(509,58)
ERROR AS220: Expression must be a compile-time constant.
size += child == 0 ? 0 : load<i32>(child, offsetof<T>("length_"));
~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(509,49)
ERROR TS2329: Index signature is missing in type 'u8'.
var byteLength = <usize>size << usize(alignof<valueof<T>>());
~
in ~lib/array.ts(513,59)
ERROR TS2558: Expected 1 type arguments, but got 0.
var byteLength = <usize>size << usize(alignof<valueof<T>>());
~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(513,43)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
var result = __alloc(offsetof<T>(), idof<T>());
~
in ~lib/array.ts(517,35)
ERROR AS203: Operation 'idof' cannot be applied to type 'u8'.
var result = __alloc(offsetof<T>(), idof<T>());
~
in ~lib/array.ts(517,46)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
store<i32>(result, size, offsetof<T>("length_"));
~
in ~lib/array.ts(518,39)
ERROR AS220: Expression must be a compile-time constant.
store<i32>(result, size, offsetof<T>("length_"));
~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(518,30)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
store<i32>(result, byteLength, offsetof<T>("byteLength"));
~
in ~lib/array.ts(521,45)
ERROR AS220: Expression must be a compile-time constant.
store<i32>(result, byteLength, offsetof<T>("byteLength"));
~~~~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(521,36)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
store<usize>(result, dataStart, offsetof<T>("dataStart"));
~
in ~lib/array.ts(522,46)
ERROR AS220: Expression must be a compile-time constant.
store<usize>(result, dataStart, offsetof<T>("dataStart"));
~~~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(522,37)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
store<usize>(result, __retain(dataStart), offsetof<T>("buffer"));
~
in ~lib/array.ts(523,56)
ERROR AS220: Expression must be a compile-time constant.
store<usize>(result, __retain(dataStart), offsetof<T>("buffer"));
~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(523,47)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
let childDataLength = load<i32>(child, offsetof<T>("byteLength"));
~
in ~lib/array.ts(534,55)
ERROR AS220: Expression must be a compile-time constant.
let childDataLength = load<i32>(child, offsetof<T>("byteLength"));
~~~~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(534,46)
ERROR AS203: Operation 'offsetof' cannot be applied to type 'u8'.
load<usize>(child, offsetof<T>("dataStart")),
~
in ~lib/array.ts(537,37)
ERROR AS220: Expression must be a compile-time constant.
load<usize>(child, offsetof<T>("dataStart")),
~~~~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(537,28)
ERROR TS2329: Index signature is missing in type 'u8'.
if (isManaged<valueof<T>>()) {
~
in ~lib/array.ts(546,27)
ERROR TS2558: Expected 1 type arguments, but got 0.
if (isManaged<valueof<T>>()) {
~~~~~~~~~~
in ~lib/array.ts(546,19)
ERROR TS2329: Index signature is missing in type 'u8'.
__retain(load<usize>(dataStart + (<usize>i << usize(alignof<valueof<T>>()))));
~
in ~lib/array.ts(548,77)
ERROR TS2558: Expected 1 type arguments, but got 0.
__retain(load<usize>(dataStart + (<usize>i << usize(alignof<valueof<T>>()))));
~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(548,61)
ERROR AS202: Type 'usize' cannot be changed to type 'u8'.
return changetype<T>(result);
~~~~~~~~~~~~~~~~~~~~~
in ~lib/array.ts(552,12)
WARNING AS232: Exported generic function or class has no concrete instances.
map<U>(fn: (value: T, index: i32, array: Array<T>) => U): Array<U> {
~~~
in ~lib/array.ts(312,3)
WARNING AS232: Exported generic function or class has no concrete instances.
reduce<U>(
~~~~~~
in ~lib/array.ts(337,3)
WARNING AS232: Exported generic function or class has no concrete instances.
reduceRight<U>(
~~~~~~~~~~~
in ~lib/array.ts(348,3)