Files
swift-mirror/test/Concurrency/implied_sendable_conformance_swift5.swift
Michael Gottesman 3ed4059a60 [sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are
talking about something that doesn't conform to the Sendable protocol which is
capitalized.

rdar://151802975
2025-05-22 11:37:58 -07:00

24 lines
998 B
Swift

// RUN: %target-typecheck-verify-swift -swift-version 5 -strict-concurrency=complete
// RUN: %target-swift-emit-silgen %s -swift-version 5 -strict-concurrency=complete
protocol P: Sendable {}
protocol Q: Sendable {}
struct One<T> { // expected-note {{consider making generic parameter 'T' conform to the 'Sendable' protocol}}
var t: T // expected-warning {{stored property 't' of 'Sendable'-conforming generic struct 'One' has non-Sendable type 'T'; this is an error in the Swift 6 language mode}}
}
extension One: P where T: P {}
struct Both<T> { // expected-note {{consider making generic parameter 'T' conform to the 'Sendable' protocol}}
var t: T // expected-warning {{stored property 't' of 'Sendable'-conforming generic struct 'Both' has non-Sendable type 'T'; this is an error in the Swift 6 language mode}}
}
extension Both: P where T: P {}
extension Both: Q where T: Q {}
func takesSendable<T: Sendable>(_: T) {}
takesSendable(One<Int>(t: 3))
takesSendable(Both<Int>(t: 3))