Skip to content

Assertion failed: Index < Length && "Invalid index!" #86315

@rayx

Description

@rayx

Description

I find the following code crashed compiler. The culprit seems to be @isolated(any) and some function in the body (not sure which one it's).

extension GlobalActor {
    static func assumeIsolated<T: Sendable>(_ operation: @isolated(any) () throws -> T) rethrows -> T {
        return try withoutActuallyEscaping(operation) { escapingClosure in
            try unsafeBitCast(escapingClosure, to: (() throws -> T).self)()
        }
    }
}

Reproduction

See above

Stack dump

See https://godbolt.org/z/ddKrqaaYE

Expected behavior

Compiler shouldn't crash.

Environment

swiftc nightly on godbolt

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwaretriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions