swift icon indicating copy to clipboard operation
swift copied to clipboard

RBI: Pattern that the region based isolation checker does not understand how to check

Open Jnosh opened this issue 1 year ago • 1 comments

Description

The following snippet produces a warning in Swift 5 mode with strict concurrency checking enabled, or an error in Swift 6 mode respectively.

Passing the isolation from run to _run explicitly does not produce an error.

Reproduction

// swiftc -swift-version 6 rbi.swift
struct Foo {
    func run<Success>(
        isolation: isolated (any Actor)? = #isolation,
        body: () async -> sending Success
    ) async -> Success {
        // error: pattern that the region based isolation checker does not understand how to check. Please file a bug
        await _run(body: body)

        // no error
        // await _run(isolation: isolation, body: body)
    }

    func _run<Success>(
        isolation _: isolated (any Actor)? = #isolation,
        body: () async -> sending Success
    ) async -> Success {
        await body()
    }
}

Expected behavior

The snippet should compile successfully.

Environment

Xcode 16 beta 3 toolchain

swift-driver version: 1.111.2 Apple Swift version 6.0 (swiftlang-6.0.0.5.15 clang-1600.0.22.6) Target: arm64-apple-macosx15.0

Additional information

No response

Jnosh avatar Jul 09 '24 12:07 Jnosh