Files
swift-mirror/lib/SIL/IR/SILDeclRef.cpp
Michael Gottesman 0a60c93ca5 [SILGen] Respect stored property's explicit global actor isolation in its initializer
Previously, when generating SIL for a stored property initializer, we would
use the enclosing context's isolation rather than the property's own explicit
isolation. For example:

    @MainActor
    struct S {
      @CustomActor var x = NS()  // initializer was incorrectly MainActor-isolated
    }

Now the initializer correctly uses the property's explicit @CustomActor isolation
instead of inheriting @MainActor from the struct.

This is implemented by checking for an explicit global actor isolation on the
VarDecl in SILDeclRef::getActorIsolation() before falling back to
getActorIsolationOfContext().
2026-02-17 12:34:16 -08:00

70 KiB