Skip to content

Overload signatures crash the compiler (assertion in ArrayRef), with or without a call #343

Closed

Description

@ASDAlexander77

Overload signatures crash the compiler, even when nothing calls the function.

function f(a: number): number;
function f(a: number, b: number): number;
function f(a: number, b?: number) { return b === undefined ? a : a + b; }

function main() {
    print("done.");
}
tslang.exe --emit=mlir --no-default-lib overloads.ts

The release build exits with 0xC0000005. A debug build asserts first:

Assertion failed: Index < this->size() && "Invalid index!", ArrayRef.h

Removing either overload signature, and keeping only the implementation, compiles.

This is not caused by the arity check in #341: it reproduces on builds from before it, and with no call in the file at all.

Found while reviewing #341, and listed there under "Not in this PR".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions