mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
23 lines
842 B
Swift
23 lines
842 B
Swift
// RUN: %target-swift-frontend -enable-sil-ownership -emit-silgen %s | %FileCheck %s
|
|
// RUN: %target-swift-frontend -enable-sil-ownership -emit-sil -verify %s
|
|
|
|
protocol BestFriend: class {
|
|
init()
|
|
static func create() -> Self
|
|
}
|
|
|
|
class Animal {
|
|
required init(species: String) {}
|
|
|
|
static func create() -> Self { return self.init() }
|
|
required convenience init() { self.init(species: "\(type(of: self))") }
|
|
}
|
|
|
|
class Dog: Animal, BestFriend {}
|
|
// CHECK-LABEL: sil private [transparent] [thunk] @_T04main3DogCAA10BestFriendA2aDPxycfCTW
|
|
// CHECK: [[SELF:%.*]] = apply
|
|
// CHECK: unchecked_ref_cast [[SELF]] : $Animal to $Dog
|
|
// CHECK-LABEL: sil private [transparent] [thunk] @_T04main3DogCAA10BestFriendA2aDP6createxyFZTW
|
|
// CHECK: [[SELF:%.*]] = apply
|
|
// CHECK: unchecked_ref_cast [[SELF]] : $Animal to $Dog
|