|
2 | 2 | // swift-module-flags:
|
3 | 3 |
|
4 | 4 | // RUN: %empty-directory(%t)
|
5 |
| -// RUN: %target-swift-frontend -emit-module-path %t/Conformances.swiftmodule -enable-resilience -emit-sil -o %t/Conformances.sil %s |
| 5 | +// RUN: %target-swift-frontend -emit-module-path %t/Conformances.swiftmodule -enable-resilience -emit-sil -o %t/Conformances.sil -enable-objc-interop -disable-objc-attr-requires-foundation-module %s |
6 | 6 | // RUN: %FileCheck -check-prefix CHECK-MODULE %s < %t/Conformances.sil
|
7 | 7 | // RUN: %FileCheck -check-prefix NEGATIVE-MODULE %s < %t/Conformances.sil
|
8 |
| -// RUN: %target-swift-frontend -emit-sil -I %t %S/Inputs/ConformancesUser.swift -O | %FileCheck %s |
| 8 | +// RUN: %target-swift-frontend -enable-objc-interop -emit-sil -I %t %S/Inputs/ConformancesUser.swift -O | %FileCheck %s |
9 | 9 |
|
10 | 10 | public protocol MyProto {
|
11 | 11 | init()
|
@@ -59,3 +59,24 @@ public struct ResilientStructImpl: MyProto {
|
59 | 59 | // CHECK: witness_method $ResilientStructImpl, #MyProto.prop!setter.1
|
60 | 60 | // CHECK: witness_method $ResilientStructImpl, #MyProto.subscript!getter.1
|
61 | 61 | // CHECK: end sil function '$s16ConformancesUser13testResilientSiyF'
|
| 62 | + |
| 63 | + |
| 64 | +@objc public protocol OptionalReqs { |
| 65 | + @objc optional func method() |
| 66 | +} |
| 67 | +@_fixed_layout |
| 68 | +public final class OptionalReqsPresent: OptionalReqs { |
| 69 | + public func method () {} |
| 70 | +} |
| 71 | +@_fixed_layout |
| 72 | +public final class OptionalReqsAbsent: OptionalReqs {} |
| 73 | + |
| 74 | +// It would be okay if this one got optimized... |
| 75 | +// CHECK-LABEL: sil @$s16ConformancesUser19testOptionalPresentySb0A00d4ReqsE0CF |
| 76 | +// CHECK: dynamic_method_br %0 : $OptionalReqsPresent, #OptionalReqs.method!1.foreign |
| 77 | +// CHECK: end sil function '$s16ConformancesUser19testOptionalPresentySb0A00d4ReqsE0CF' |
| 78 | + |
| 79 | +// ...but not this one, because the method that's currently absent might get added. |
| 80 | +// CHECK-LABEL: sil @$s16ConformancesUser18testOptionalAbsentySb0A00d4ReqsE0CF |
| 81 | +// CHECK: dynamic_method_br %0 : $OptionalReqsAbsent, #OptionalReqs.method!1.foreign |
| 82 | +// CHECK: end sil function '$s16ConformancesUser18testOptionalAbsentySb0A00d4ReqsE0CF' |
0 commit comments