Skip to content

Trying to access a property of an anonymous arrow function without a return type crashes the compiler #2036

Closed
@pufferfish101007

Description

@pufferfish101007

Example:

const a: u32 = (() => 56).index;

This leads to a compiler crash, when it should give a readable error, something like this:

ERROR TS1110: Type expected.
 const a: u32 = (() => 56).index;
                               ^
 in input.ts(1,18)
FAILURE 1 compile error(s)

source-map-support doesn't seem to be working for me, so I can't locate the source of the crash properly - here's the full error in case it helps:

▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌ 
▌ Here is a stack trace that may or may not be useful:
▌ 
▌ AssertionError: assertion failed
▌     at i.assert (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:756191)
▌     at p.canOverflow (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:444491)
▌     at f.compileFunctionBody (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:229321)
▌     at f.compileFunction (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:228098)
▌     at f.compileFunctionExpression (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:314156)
▌     at f.compileExpression (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:253851)
▌     at f.compilePropertyAccessExpression (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:339138)
▌     at f.compileExpression (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:254315)
▌     at f.compileGlobal (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:223508)
▌     at f.compileTopLevelStatement (/rbd/pnpm-volume/37298188-a1a3-4629-b12a-0b3b94a685e8/node_modules/assemblyscript/dist/assemblyscript.js:7:237636)
▌ 
▌ 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!

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