mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Forming an isolated conformance to a SendableMetatype-inherting protocol opens up a soundness hole any time the conformance is used. Reword the recently-introduced diagnostic for this case and promote it to an error (except when it's preconcurrency). Fixes rdar://154808002.
23 lines
659 B
Swift
23 lines
659 B
Swift
// RUN: %target-swift-frontend -typecheck -verify -target %target-swift-5.1-abi-triple -swift-version 6 %s
|
|
|
|
// REQUIRES: concurrency
|
|
|
|
protocol P: SendableMetatype {
|
|
func f()
|
|
}
|
|
|
|
@preconcurrency
|
|
protocol Q: SendableMetatype {
|
|
func f()
|
|
}
|
|
|
|
// expected-error@+1{{cannot form main actor-isolated conformance of 'PSendableSMainActor' to SendableMetatype-inheriting protocol 'P'}}
|
|
@MainActor struct PSendableSMainActor: @MainActor P {
|
|
func f() { }
|
|
}
|
|
|
|
// expected-warning@+1{{cannot form main actor-isolated conformance of 'QSendableSMainActor' to SendableMetatype-inheriting protocol 'Q'}}
|
|
@MainActor struct QSendableSMainActor: @MainActor Q {
|
|
func f() { }
|
|
}
|