-
-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG/HELP] Extends Array does not compile #1351
Comments
Did you update UPDATE Reproduced here |
Quick workaround: export class MyArray extends Uint8Array {
} If it's possible |
Or don't export |
Thank you so much for your help. Just to be on the same page -> Is it some kind of bug? If so, could we expect to be fixed in one of the next releases? If, however, this is the expected behavior, that means there is no way to extend Array, right? |
You could extend Array but you can't export such extended class as well as any other generic class or method cross wasm module boundary. So this absolutely valid as you can see: But not: export function boo<T>(): void {} // `T` unresolved during export to JavaScript or other host or export class Foo<T> {} // `T` unresolved during export to JavaScript or other host or export class Boo extends Foo<u8> {
flat<U>(): u8 { return 0 } // `U` unresolved during export to JavaScript or other host
} All that cases will print warnings |
The reason why this is failing is that Given that this is failing in an unexpected way, I suggest changing this line to a |
@dcodeIO It's just half of problem. I tried just overload However I'll try make PR which expose such changes. Will see what happens |
@dcodeIO So #1353 fix only one case when: export class MyArray extends Array<i32> {} But we still have issues for this case (when type is export class MyArray extends Array<u8> {} Output:
|
Maybe something like if (isReference<T>()) {
store<usize>(base + (<usize>lastIndex << alignof<T>()), 0);
} else {
store<T>(base + (<usize>lastIndex << alignof<T>()), 0);
} |
Currently I just switched to |
But does this work on |
You're right. |
Should be fixed in next minor release |
Hello,
Version: assemblyscript@0.12.3
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
Compilation Log
The text was updated successfully, but these errors were encountered: