mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
29 lines
734 B
Swift
29 lines
734 B
Swift
// RUN: %target-swift-emit-ir -parse-as-library -module-name main -verify %s -enable-experimental-feature Embedded -wmo
|
|
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
protocol ClassBound: AnyObject {
|
|
func foo()
|
|
}
|
|
|
|
protocol OtherProtocol {
|
|
func bar()
|
|
}
|
|
|
|
class MyClass: ClassBound, OtherProtocol {
|
|
func foo() { print("MyClass.foo()") }
|
|
func bar() { print("MyClass.bar()") }
|
|
}
|
|
|
|
// Currently we don't support this
|
|
func test(existential: any ClassBound & OtherProtocol) {
|
|
}
|
|
|
|
@main
|
|
struct Main {
|
|
static func main() {
|
|
test(existential: MyClass()) // expected-error {{cannot use a value of protocol type 'any ClassBound & OtherProtocol' in embedded Swift}}
|
|
// expected-note@-4 {{called from here}}
|
|
}
|
|
}
|