-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Concurrency] Start diagnosing use of global actor isolated propertie…
…s in key paths in strict mode If key path is formed in a concurrency domain different from the one where the member is, diagnose that as a warning in a strict mode and error in swift 6 mode with strict concurrency enabled.
- Loading branch information
Showing
5 changed files
with
73 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify | ||
|
||
// REQUIRES: concurrency && asserts | ||
|
||
actor Door { | ||
@MainActor var globActor_mutable : Int = 0 | ||
@MainActor(unsafe) var unsafeGlobActor_mutable : Int = 0 | ||
@MainActor subscript(byName: String) -> Int { 0 } | ||
} | ||
|
||
func tryKeyPathsFromAsync() async { | ||
_ = \Door.unsafeGlobActor_mutable // no warning | ||
} | ||
|
||
func tryKeypaths() { | ||
_ = \Door.unsafeGlobActor_mutable // no warning | ||
_ = \Door.globActor_mutable // no warning | ||
_ = \Door.["hello"] // no warning | ||
} | ||
|
||
@MainActor func testGlobalActorRefInSameContext() { | ||
_ = \Door.unsafeGlobActor_mutable // Ok | ||
_ = \Door.globActor_mutable // Ok | ||
_ = \Door.["hello"] // Ok | ||
} |