1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// Note: this test has a client: inherits-superclass-initializers-client.swift
// RUN: %empty-directory(%t)
// RUN: %target-swift-emit-module-interface(%t/Module.swiftinterface) %s -module-name Module
// RUN: %target-swift-typecheck-module-from-interface(%t/Module.swiftinterface) -module-name Module
// RUN: %FileCheck %s < %t/Module.swiftinterface
// CHECK: @_hasMissingDesignatedInitializers open class Base {
open class Base {
// CHECK-NEXT: public init(arg: Swift.Int)
public init(arg: Int) {
print("public init from Base")
}
// CHECK-NOT: init(secret: Swift.Int)
internal init(secret: Int) {
print("secret init from Base")
}
// CHECK: convenience public init()
public convenience init() {
self.init(secret: 4)
}
// CHECK: }
}
// CHECK-NOT: @_hasMissingDesignatedInitializers
// CHECK: open class InlineBase {
open class InlineBase {
// CHECK-NEXT: public init(arg: Swift.Int)
public init(arg: Int) {
print("public init from Inline Base")
}
// CHECK-NOT: @usableFromInline init(secret: Swift.Int)
@usableFromInline
internal init(secret: Int) {
print("secret init from Inline Base")
}
// CHECK: convenience public init()
public convenience init() {
self.init(secret: 42)
}
// CHECK: }
}
// CHECK: @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class Sub : Module.Base {
public class Sub : Base {
// CHECK: override public init(arg: Swift.Int)
public override init(arg: Int) {
print("public init from Sub")
super.init(arg: arg)
}
// CHECK-NOT: init(secret: Swift.Int)
internal override init(secret: Int) {
print("secret init from Sub")
super.init(secret: secret)
}
// CHECK: }
}
// CHECK: @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class SubSub : Module.Sub {
public class SubSub: Sub {
// CHECK: override public init(arg: Swift.Int)
public override init(arg: Int) {
print("public init from SubSub")
super.init(arg: arg)
}
// CHECK-NOT: init(secret: Swift.Int)
internal override init(secret: Int) {
print("secret init from SubSub")
super.init(secret: secret)
}
// CHECK: }
}
@inlinable public func test() {
_ = Sub()
_ = SubSub()
}
|