Skip to content

typeof a recursive declaration crashes the compiler #2211

Closed
@romdotdog

Description

@romdotdog

Similar to #2204, but this doesn't require being able to use its own variable

Code

let e = e;
typeof [e];

Try it in the playground

Stack trace

▌ Whoops, the AssemblyScript compiler has crashed during compile :-(
▌ 
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌ 
▌ RangeError: Maximum call stack size exceeded
▌     at File.lookup (D:\assemblyscript\src\program.ts:3062:9)
▌     at Function.lookup (D:\assemblyscript\src\program.ts:2782:24)
▌     at Function.lookup (D:\assemblyscript\src\program.ts:3694:18)
▌     at Flow.lookup (D:\assemblyscript\src\flow.ts:569:32)
▌     at Resolver.lookupIdentifierExpression (D:\assemblyscript\src\resolver.ts:1139:27)
▌     at Resolver.resolveIdentifierExpression (D:\assemblyscript\src\resolver.ts:1202:24)
▌     at Resolver.resolveExpression (D:\assemblyscript\src\resolver.ts:1054:21)
▌     at Resolver.ensureResolvedLazyGlobal (D:\assemblyscript\src\resolver.ts:1229:19)
▌     at Resolver.getTypeOfElement (D:\assemblyscript\src\resolver.ts:857:17)
▌     at Resolver.resolveIdentifierExpression (D:\assemblyscript\src\resolver.ts:1209:21)
▌     at Resolver.resolveExpression (D:\assemblyscript\src\resolver.ts:1054:21)
▌     at Resolver.ensureResolvedLazyGlobal (D:\assemblyscript\src\resolver.ts:1229:19)
▌     at Resolver.getTypeOfElement (D:\assemblyscript\src\resolver.ts:857:17)
▌     at Resolver.resolveIdentifierExpression (D:\assemblyscript\src\resolver.ts:1209:21)
▌     at Resolver.resolveExpression (D:\assemblyscript\src\resolver.ts:1054: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!

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