mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Constraint generation uses a special pattern while generating constraints for assignments to make sure that the source type is convertible to r-value type of the destination. `BindingSet::favoredOverDisjunction` needs to recognize this pattern, where disjunction type variable is bound early, and avoid prioritizing closure if it's connected to the "fixed type" of the disjunction or risk losing annotations associated with the member such as `@Sendable` or a global actor. Resolves: rdar://131524246
23 lines
494 B
Swift
23 lines
494 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 5
|
|
// RUN: %target-typecheck-verify-swift -swift-version 5 -strict-concurrency=complete
|
|
// RUN: %target-typecheck-verify-swift -swift-version 6
|
|
|
|
// rdar://131524246
|
|
|
|
protocol P: Sendable {
|
|
typealias Block = @Sendable () -> Void
|
|
var block: Block? { get }
|
|
}
|
|
|
|
extension P {
|
|
var block: Block? { nil }
|
|
}
|
|
|
|
final class Impl: P, @unchecked Sendable {
|
|
var block: Block?
|
|
}
|
|
|
|
func test(_ v: Impl) {
|
|
v.block = {} // Ok, no warnings or errors
|
|
}
|