Files
swift-mirror/test/SILGen/witness-init-requirement-with-base-class-init.swift
2017-10-25 13:35:17 -07:00

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