Bug description
compiler crashed when generic function override non generic function
Steps to reproduce
var called: string = "";
class A {
foo<T>(x: T): void {
called = "A";
}
}
class B extends A {
foo(x: i32): void { // non-generic overrides generic
called = "B";
}
}
// Static dispatch: B.foo called directly
var b = new B();
b.foo(1);
assert(called == "B");
called = "";
// Virtual dispatch through A reference: which gets called?
var a: A = new B();
a.foo<i32>(1);
assert(called == "B"); // if vtable works, "B"; if fallback to base, "A"
build above code
node ./bin/asc.js --debug -o build/test.wasm -t build/test.wat test.ts
2
Debugger attached.
▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌
▌ AssertionError: assertion failed
▌ at assert2 (/Users/Q479807/workspace/github/assemblyscript/std/portable/index.js:216:11)
▌ at Resolver.resolveFunction (/Users/Q479807/workspace/github/assemblyscript/src/resolver.ts:2790:7)
▌ at Resolver.resolveOverrides (/Users/Q479807/workspace/github/assemblyscript/src/resolver.ts:3077:39)
▌ at _Compiler.compile (/Users/Q479807/workspace/github/assemblyscript/src/compiler.ts:615:42)
▌ at Module.compile (/Users/Q479807/workspace/github/assemblyscript/src/index-wasm.ts:358:32)
▌ at Module.main (/Users/Q479807/workspace/github/assemblyscript/cli/index.js:732:31)
▌ at async file:///Users/Q479807/workspace/github/assemblyscript/bin/asc.js:33:22
▌
▌ If you see where the error is, feel free to send us a pull request. If not,
▌ please let us know: https://github.com/AssemblyScript/assemblyscript/issues
▌
▌ Thank you!
AssemblyScript version
v0.28.12
Bug description
compiler crashed when generic function override non generic function
Steps to reproduce
build above code
AssemblyScript version
v0.28.12