Skip to content

compiler crashed when duplicate inner function define in function body #2999

@Changqing-JING

Description

@Changqing-JING

Bug description

compiler crashed when duplicate inner function define in function body

Steps to reproduce

export function test(): void {
  
  function inner(): i32 {
    let x: i32 = 0;
    return x;
  }
  function inner(): i32 {
    let x: i32 = 0;
    return x + 1;
  }
  inner();
}

Command and error message

 node ./bin/asc.js ./demo/test.ts

▌ 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 Z.assert (D:\code\workspace\github\assemblyscript\std\portable\index.js:216:11)
▌     at registerConcreteElement (D:\code\workspace\github\assemblyscript\src\program.ts:4958:3)
▌     at new t (D:\code\workspace\github\assemblyscript\src\program.ts:3853:5)
▌     at Nn.resolveFunction (D:\code\workspace\github\assemblyscript\src\resolver.ts:2885:20)
▌     at t.compileFunctionExpression (D:\code\workspace\github\assemblyscript\src\compiler.ts:7304:32)
▌     at t.compileExpression (D:\code\workspace\github\assemblyscript\src\compiler.ts:3464:21)
▌     at t.compileExpressionStatement (D:\code\workspace\github\assemblyscript\src\compiler.ts:2560:17)
▌     at t.compileStatement (D:\code\workspace\github\assemblyscript\src\compiler.ts:2262:21)
▌     at t.compileStatements (D:\code\workspace\github\assemblyscript\src\compiler.ts:2337:23)
▌     at t.compileFunctionBody (D:\code\workspace\github\assemblyscript\src\compiler.ts:1777:20)

▌ 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

v0.28.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions