Skip to content

Incorrect isolation domain in diagnostic #86314

@rayx

Description

@rayx

Description

The error message in the following code is incorrect. The closure in test() runs in an isolated domain of A instance, but the diagnostic says it's nonisolated.

actor A {
    var value = 0
}

actor B {
    var value = 0

    func test() {
        let _: (isolated A) -> Void = { a in
            a.value = 1 // OK
            self.value = 1 // error: actor-isolated property 'value' can not be mutated from a nonisolated context
        }
    }
}

Reproduction

See above

Expected behavior

The diagnostic should be something like:

actor-isolated property 'value' can not be mutated from a different actor-isolated context

Environment

I use swiftc nightly build on godbolt, with -swift-version 6 setting.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage 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