mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
It seems that the restriction preventing these from working was lifted. The behavioral difference is that in Swift 5 mode, we don't actually open AnyObject like this, so the old operator could not be used with class-bound existentials. I added a trivial test case just to ensure that calls to === type check correctly in both language modes. Fixes rdar://156095800.
37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo -swift-version 5) | %FileCheck %s
|
|
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo -O -swift-version 5) | %FileCheck %s
|
|
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo -Osize -swift-version 5) | %FileCheck %s
|
|
|
|
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo -swift-version 6) | %FileCheck %s
|
|
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo -O -swift-version 6) | %FileCheck %s
|
|
// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo -Osize -swift-version 6) | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: optimized_stdlib
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
protocol P: AnyObject {}
|
|
|
|
class C: P {}
|
|
|
|
@main
|
|
struct Main {
|
|
static func main() {
|
|
let p1: any P = C()
|
|
let p2: any P = C()
|
|
let p3 = p1
|
|
|
|
// CHECK: false
|
|
print(p1 === p2)
|
|
print(p2 === p1)
|
|
// CHECK: true
|
|
print(p1 === p3)
|
|
print(p3 === p1)
|
|
// CHECK: false
|
|
print(p2 === p3)
|
|
print(p3 === p2)
|
|
}
|
|
}
|
|
|