Avatar
Avatar
Iceman
@swift-main @swift-5.5.3 -warn-concurrency @MainActor protocol P { } struct S: P {} Task { await MainActor.run { let p: P = S() let optionalP: P! = nil let s: S = S() Task { print(String(describing: p)) print(String(describing: optionalP)) print(String(describing: s)) } } } (edited)
swiftNightly BOT 11/19/2021 3:19 AM
stderr:<stdin>:11:32: warning: cannot use let 'p' with a non-sendable type 'P' from concurrently-executed code print(String(describing: p)) ^ <stdin>:1:21: note: protocol 'P' does not conform to the 'Sendable' protocol @MainActor protocol P { } ^ <stdin>:12:32: warning: cannot use let 'optionalP' with a non-sendable type 'P?' from concurrently-executed code print(String(describing: optionalP)) ^ <stdin>:1:21: note: protocol 'P' does not conform to the 'Sendable' protocol @MainActor protocol P { } ^ (edited)