Closed
Description
Bug description
Consider the source code below. The function expectCallback
needs another function as its argument to produce a number. If we use callback
this works as expected.
However, if (by mistake) we use a method we'd expect the compiler to detect a signature mismatch because methods implicitly have an extra this
parameter. This is not detected. The code below compiles without issues.
Only during runtime we see the expected problem:
RuntimeError: null function or function signature mismatch
at assembly/index/expectCallback (wasm://wasm/ca122872:wasm-function[50]:0xfee)
Steps to reproduce
function callback(a: i32): i32 {
return a + 3
}
class C {
callback(a: i32): i32 {
return a + 3
}
}
function expectCallback(c: ((arg0:i32) => i32)): i32 {
return c(4)
}
export function fut(): i32 {
//return expectCallback(callback)
const cl = new C()
return expectCallback(cl.callback)
}
AssemblyScript version
0.27.5