Skip to content

compiler crashed when callback function signature has a void as parameter type #2997

@Changqing-JING

Description

@Changqing-JING

Bug description

compiler crashed when callback function signature has a void as parameter type

Steps to reproduce

Source code

class C1<T> {
  then(cb: (value: T) => void): void {}
}

new C1<void>().then(function (): void {});

compile command

node ./bin/asc.js ./demo/test.ts

▌ 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 (D:\code\workspace\github\assemblyscript\std\portable\index.js:216:11)
▌     at new Local (D:\code\workspace\github\assemblyscript\src\program.ts:3652:5)
▌     at new _Function (D:\code\workspace\github\assemblyscript\src\program.ts:3840:21)
▌     at _Compiler.compileFunctionExpression (D:\code\workspace\github\assemblyscript\src\compiler.ts:7290:18)
▌     at _Compiler.compileExpression (D:\code\workspace\github\assemblyscript\src\compiler.ts:3464:21)
▌     at _Compiler.compileCallDirect (D:\code\workspace\github\assemblyscript\src\compiler.ts:6437:28)
▌     at _Compiler.compileCallExpression (D:\code\workspace\github\assemblyscript\src\compiler.ts:6147:21)
▌     at _Compiler.compileExpression (D:\code\workspace\github\assemblyscript\src\compiler.ts:3452:21)
▌     at _Compiler.compileExpressionStatement (D:\code\workspace\github\assemblyscript\src\compiler.ts:2560:17)
▌     at _Compiler.compileStatement (D:\code\workspace\github\assemblyscript\src\compiler.ts:2262:21)
▌
▌ 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.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions