Skip to content

Adding .defaultIsolation(MainActor.self) breaks cross-module protocol conformance when building with --static-swift-stdlib #82682

Closed
@MaxDesiatov

Description

@MaxDesiatov

Description

A simple reproduction is available for the bug that contains three modules: two libraries and on executable depending on these libraries. The executable checks for protocol conformance declared in one of the libraries. When .defaultIsolation(MainActor.self) is enabled on libraries and the package is built with swift build --static-swift-stdlib for Linux or Wasm, the protocol conformance check unexpectedly fails. When removing either .defaultIsolation or --static-swift-stdlib, the protocol conformance works as expected.

Reproduction

Run this on Linux (tested with Ubuntu 24.04, Docker image 1f181af69eab for swiftlang/swift:nightly-noble)

1. `git clone https://github.com/kateinoigakukun/swift-wasm-demo`
2. `cd swift-wasm-demo`
3. `git checkout f60e4b1e635c95fa7bb20cc3b1a24bc218d9ea63`
4. `swift build --static-swift-stdlib`
5. `./.build/debug/WasmDemo`

Or run this on macOS with swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a or swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-27-a

1. `git clone https://github.com/kateinoigakukun/swift-wasm-demo`
2. `cd swift-wasm-demo`
3. `git checkout f60e4b1e635c95fa7bb20cc3b1a24bc218d9ea63`
4. Depending on the toolchain version used, install a matching Swift SDK for Wasm: `swift sdk install https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a/swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a_wasm.artifactbundle.tar.gz --checksum dfba0e1f123c55a55ff5c9c12b7c978299cbbdca5519423dffa2c775857720e5` or `swift sdk install https://download.swift.org/swift-6.2-branch/wasm-sdk/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-27-a/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-27-a_wasm.artifactbundle.tar.gz --checksum 967c0d853bb37c02682f8d19ba5a29534aa37b1d6204e92f2a555ef3a65458f0`
5. Depending on Swift SDK and toolchain versions installed `swift run --swift-sdk swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a_wasm` or `swift run --swift-sdk swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-27-a`

Expected behavior

Expected output:

Window.self is DeferredRender.Type: true
V.self is DeferredRender.Type: true
type(of: view): Window
view is DeferredRender: true

Actual output:

Window.self is DeferredRender.Type: true
V.self is DeferredRender.Type: true
type(of: view): Window
view is DeferredRender: false

Environment

swift-DEVELOPMENT-SNAPSHOT-2025-06-22-a or swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-27-a

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConcurrencуArea → standard library: The `Concurrency` module under the standard library umbrellabugA deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featuresconformancesFeature → protocol: protocol conformancesstatic stdlib

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions