Skip to content

Pattern that the region-based isolation checker does not understand how to check #75441

Open
@samsonjs

Description

@samsonjs

Description

In Xcode 16.0 beta 4 there's a new compiler error for code that used to build in previous betas.

Possibly related to #75439

Reproduction

actor A {
    var things: [String]

    init() {
        things = []
    }
}

@MainActor class B {
    let a = A()

    var stuff: [String] = []

    func doSomething() async {
        // ❌ Pattern that the region based isolation checker does not understand how to check. Please file a bug
        stuff = await a.things
    }
}

Expected behavior

This worked fine in previous betas of Xcode 16.0. It should compile without issues.

Environment

% swiftc -version
swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1)
Target: arm64-apple-macosx14.0

Additional information

Using a method instead of directly accessing the var works just fine.

actor A {
    var things: [String]

    init() {
        things = []
    }

    func getThings() -> [String] { things }
}

@MainActor class B {
    let a = A()

    var stuff: [String] = []

    func doSomething() async {
        // ✅ works fine with methods
        stuff = await a.getThings()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    SILactorFeature → concurrency: `actor` declarationsactor isolationFeature → concurrency: Actor isolationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresexpressionsFeature: expressionsinternal errorBug: Internal errorswift 6.0unexpected errorBug: Unexpected error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions