Closed
Description
The issue
This is erroneous code, but it crashes the compiler:
enum Bar {
Baz
}
export function foo(): boolean {
return Bar.Baz;
}
foo();
The stack trace
▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌
▌ Here is a stack trace that may or may not be useful:
▌
▌ AssertionError: assertion failed
▌ at assert (D:\assemblyscript\std\portable\index.js:199:9)
▌ at Flow.canOverflow (D:\assemblyscript\src\flow.ts:1221:9)
▌ at Compiler.ensureSmallIntegerWrap (D:\assemblyscript\src\compiler.ts:10023:18)
▌ at Compiler.compileExpression (D:\assemblyscript\src\compiler.ts:3544:27)
▌ at Compiler.compileReturnStatement (D:\assemblyscript\src\compiler.ts:2820:19)
▌ at Compiler.compileStatement (D:\assemblyscript\src\compiler.ts:2209:21)
▌ at Compiler.compileStatements (D:\assemblyscript\src\compiler.ts:2273:23)
▌ at Compiler.compileFunctionBody (D:\assemblyscript\src\compiler.ts:1609:20)
▌ at Compiler.compileFunction (D:\assemblyscript\src\compiler.ts:1539:17)
▌ at Compiler.makeCallDirect (D:\assemblyscript\src\compiler.ts:7211:15)
▌ at Compiler.compileCallDirect (D:\assemblyscript\src\compiler.ts:6699:17)
▌ at Compiler.compileCallExpression (D:\assemblyscript\src\compiler.ts:6314:21)
▌ at Compiler.compileExpression (D:\assemblyscript\src\compiler.ts:3459:21)
▌ at Compiler.compileExpressionStatement (D:\assemblyscript\src\compiler.ts:2496:17)
▌ at Compiler.compileStatement (D:\assemblyscript\src\compiler.ts:2193:21)
▌
▌ If it refers to the dist files, try to 'npm install source-map-support' and
▌ run again, which should then show the actual code location in the sources.
▌
▌ 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!
Credits
Thanks to @fabriciopashaj for crashing the compiler