You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's my minimal example: when I follow the instructions here (https://docs.assemblyscript.org/quick-start) with a clean install and clean directory and use this as my index.ts I get a compiler error
index.ts:
// The entry file of your WebAssembly module.
@unmanaged
export class Foo {
use_anon_function(fn: (value: i32) => i32): Array<i32> {
return new Array<i32>();
}
}
export function anon_test(bars: Foo, value: i32): i32 {
let bar_ids = bars.use_anon_function((bar: i32) =>
value
);
return bar_ids.length;
}
npm run asbuild output:
> @ asbuild /Users/duncanuszkay/src/github.com/Shopify/temp-delete
> npm run asbuild:untouched && npm run asbuild:optimized
> @ asbuild:untouched /Users/duncanuszkay/src/github.com/Shopify/temp-delete
> asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --validate --debug
[wasm-validator error in function $assembly/index/anon_test~anonymous|0] unexpected false: local.get index must be small enough, on
[i32] (local.get $1)
[wasm-validator error in function $assembly/index/anon_test~anonymous|0] unexpected false: local.get must have proper type, on
[i32] (local.get $1)
ERROR: Validate error
at /Users/duncanuszkay/src/github.com/Shopify/temp-delete/node_modules/assemblyscript/cli/asc.js:573:25
at measure (/Users/duncanuszkay/src/github.com/Shopify/temp-delete/node_modules/assemblyscript/cli/asc.js:880:3)
at Object.main (/Users/duncanuszkay/src/github.com/Shopify/temp-delete/node_modules/assemblyscript/cli/asc.js:570:27)
at Object.<anonymous> (/Users/duncanuszkay/src/github.com/Shopify/temp-delete/node_modules/assemblyscript/bin/asc:21:26)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11
If I don't use the function argument inside the anon function it compiles:
index.ts
// The entry file of your WebAssembly module.
@unmanaged
export class Foo {
use_anon_function(fn: (value: i32) => i32): Array<i32> {
return new Array<i32>();
}
}
export function anon_test(bars: Foo, value: i32): i32 {
let bar_ids = bars.use_anon_function((bar: i32) =>
100
);
return bar_ids.length;
}
Looks like I can't use function arguments inside anonymous functions? The error message given doesn't seem to be correlated though.
Let me know if you need any more info
The text was updated successfully, but these errors were encountered:
@DuncanUszkay1 In next daily night build such closure cases will be fail earlier with "AS100: Not implemented." error instead "unknown" validation error
Since we emit proper "not implemented" error and we already have bunch of several issues relate to closure's issue I'm closing this. Plz watch for progress in #798
Here's my minimal example: when I follow the instructions here (https://docs.assemblyscript.org/quick-start) with a clean install and clean directory and use this as my index.ts I get a compiler error
index.ts:
npm run asbuild
output:If I don't use the function argument inside the anon function it compiles:
index.ts
Looks like I can't use function arguments inside anonymous functions? The error message given doesn't seem to be correlated though.
Let me know if you need any more info
The text was updated successfully, but these errors were encountered: