Skip to content

Compiler crashes when using ref_extern member variable in class #2726

Closed
@ijsf

Description

@ijsf

Bug description

The compiler crashes whenever a ref_extern is used as a member variable of a class. Also happens for similar reference types (e.g. ref_func) or nullable reference types (e.g. externref).

Steps to reproduce

Use the following code:

class MyWrapper {
  ref: externref;
}
let mywrapper = new MyWrapper();

This causes a compiler assertion:

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 Y.assert (.\wasm\node_modules\assemblyscript\std\portable\index.js:216:11)
▌     at Kn.finishResolveClass (.\wasm\node_modules\assemblyscript\src\resolver.ts:3433:19)
▌     at Kn.resolveClass (.\wasm\node_modules\assemblyscript\src\resolver.ts:3222:10)
▌     at Kn.resolveClassInclTypeArguments (.\wasm\node_modules\assemblyscript\src\resolver.ts:3652:17)
▌     at jr.compileNewExpression (.\wasm\node_modules\assemblyscript\src\compiler.ts:8710:37)
▌     at jr.compileExpression (.\wasm\node_modules\assemblyscript\src\compiler.ts:3397:21)
▌     at jr.compileGlobal (.\wasm\node_modules\assemblyscript\src\compiler.ts:1183:25)
▌     at jr.compileTopLevelStatement (.\wasm\node_modules\assemblyscript\src\compiler.ts:2125:20)
▌     at jr.compileFile (.\wasm\node_modules\assemblyscript\src\compiler.ts:1099:12)
▌     at jr.compile (.\wasm\node_modules\assemblyscript\src\compiler.ts:548:14)
▌
▌ 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

0.27.6

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