Skip to content

Commit 4e7a35f

Browse files
committed
Change expected objcImpl private let optimization
Previous changes have made it so that `private let`s in an objcImpl extension are implicitly `@objc`, which changed downstream behavior in a SILOptimizer test. The new behavior is actually more correct, so codify this behavior change by modifying the test.
1 parent 6890657 commit 4e7a35f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/SILOptimizer/let_properties_opts_objc.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public func testObjcInterface(_ x: ObjcInterface) -> Int {
1616
return x.i
1717
}
1818

19-
// Test optimization of a private constant. This constant must be declared in a separate type without other fields.
19+
// Test that private @objc constants aren't optimized, but instead continue to pass through ObjC message dispatch.
2020
@_objcImplementation extension ObjcInterfaceConstInit {
2121
private let constant: Int = 0
2222

2323
// CHECK-LABEL: sil hidden @$sSo22ObjcInterfaceConstInitC4testE0E15PrivateConstantSiyF : $@convention(method) (@guaranteed ObjcInterfaceConstInit) -> Int {
24-
// CHECK: ref_element_addr [immutable] %0 : $ObjcInterfaceConstInit, #ObjcInterfaceConstInit.constant
24+
// CHECK: objc_method %0 : $ObjcInterfaceConstInit, #ObjcInterfaceConstInit.constant!getter.foreign
2525
// CHECK-LABEL: } // end sil function '$sSo22ObjcInterfaceConstInitC4testE0E15PrivateConstantSiyF'
2626
final func testPrivateConstant() -> Int {
2727
return constant

0 commit comments

Comments
 (0)