Skip to content

Exporting a function with a first-class function parameter crashes the compiler #2283

Closed
@romdotdog

Description

@romdotdog

Code

export function foo(x: () => void): void {}

Try it in the playground

Stack traces

▌ Whoops, the AssemblyScript compiler has crashed during buildTSD :-(
▌ 
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌ 
▌ /data/assemblyscript/std/portable/index.js:200
▌     throw new AssertionError(message);
▌           ^
▌ 
▌ AssertionError: assertion failed
▌     at null.q.assert (/data/assemblyscript/std/portable/index.js:200:11)
▌     at TSDBuilder.toTypeScriptType (/data/assemblyscript/src/bindings/tsd.ts:239:21)
▌     at TSDBuilder.visitFunction (/data/assemblyscript/src/bindings/tsd.ts:156:20)
▌     at TSDBuilder.visitFunctionInstances (/data/assemblyscript/src/bindings/util.ts:132:53)
▌     at TSDBuilder.visitElement (/data/assemblyscript/src/bindings/util.ts:91:14)
▌     at TSDBuilder.visitFile (/data/assemblyscript/src/bindings/util.ts:59:14)
▌     at TSDBuilder.walk (/data/assemblyscript/src/bindings/util.ts:47:65)
▌     at TSDBuilder.build (/data/assemblyscript/src/bindings/tsd.ts:189:10)
▌     at Function.build (/data/assemblyscript/src/bindings/tsd.ts:37:41)
▌     at Module.JS (/data/assemblyscript/src/index-wasm.ts:330:21)
▌     at Object.Ue (/data/assemblyscript/cli/index.js:954:35)
▌     at async runTest (file:///data/assemblyscript/tests/compiler.js:194:23)
▌     at async file:///data/assemblyscript/tests/compiler.js:565:31
▌ 
▌ 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!
▌ Whoops, the AssemblyScript compiler has crashed during buildJS :-(
▌ 
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌ 
▌ /data/assemblyscript/std/portable/index.js:200
▌     throw new AssertionError(message);
▌           ^
▌ 
▌ AssertionError: assertion failed
▌     at null.q.assert (/data/assemblyscript/std/portable/index.js:200:11)
▌     at JSBuilder.makeLowerToValue (/data/assemblyscript/src/bindings/js.ts:1021:21)
▌     at JSBuilder.visitFunction (/data/assemblyscript/src/bindings/js.ts:390:16)
▌     at JSBuilder.visitFunctionInstances (/data/assemblyscript/src/bindings/util.ts:132:53)
▌     at JSBuilder.visitElement (/data/assemblyscript/src/bindings/util.ts:91:14)
▌     at JSBuilder.visitFile (/data/assemblyscript/src/bindings/util.ts:59:14)
▌     at JSBuilder.walk (/data/assemblyscript/src/bindings/util.ts:47:65)
▌     at JSBuilder.build (/data/assemblyscript/src/bindings/js.ts:616:10)
▌     at Function.build (/data/assemblyscript/src/bindings/js.ts:99:40)
▌     at Module.$S (/data/assemblyscript/src/index-wasm.ts:335:20)
▌     at Object.Ue (/data/assemblyscript/cli/index.js:956:35)
▌     at async runTest (file:///data/assemblyscript/tests/compiler.js:194:23)
▌     at async file:///data/assemblyscript/tests/compiler.js:565:31
▌ 
▌ 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions