mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When SE-0412 (strict concurrency for global variables) is enabled, each global or static mutable variable will be diagnosed if it isn't explicitly on a global actor or `nonisolated(unsafe)`. Suppress diagnostics for references to such global variables when they are in the same module as the declaration of the global variable itself. While these diagnostics are technically correct, they are not strictly necessary since we've already diagnosed the global variable itself (with more actionable advice), and they tend to pile on the developer in a manner that is not helpful.
15 lines
409 B
Swift
15 lines
409 B
Swift
public struct Globals {
|
|
public static let integerConstant = 0
|
|
public static var integerMutable = 0
|
|
|
|
public static nonisolated(unsafe) let nonisolatedUnsafeIntegerConstant = 0
|
|
public static nonisolated(unsafe) var nonisolatedUnsafeIntegerMutable = 0
|
|
|
|
@MainActor public static var actorInteger = 0
|
|
|
|
public init() {}
|
|
}
|
|
|
|
public var mutableGlobal: String = "can't touch this"
|
|
public var globalInt = 17
|