mirror of
https://github.com/apple/swift.git
synced 2026-10-06 12:37:28 +02:00
Enable SILGen, SIL verification, and AddressLowering of `keypath` instructions under -enable-sil-opaque-values. Existing keypath SIL-optimizer tests are extended to exercise the opaque-values pipeline. In opaque-values mode, TypeLowering::handleAddressOnly lowers address-only AST types as objects until AddressLowering runs, so getLoweredType returns the object form for address-only KeyPath index parameters. The keypath runtime ABI requires the address form, and KeyPathPatternComponent caches its lowered index type — AddressLowering does not reconstruct the pattern with refreshed lowerings. Bypass TypeLowering in lowerKeyPathMemberIndexTypes with the static SILType::isAddressOnly (which reads SILTypeProperties directly, skipping handleAddressOnly's opaque-values override) and switch address-only index lowerings to address form during pattern construction. A cleaner fix would either drop the cached lowering from KeyPathPatternComponent::Index, or have AddressLowering rebuild the keypath pattern with refreshed lowerings — both larger refactors, deferred for now.
9 lines
330 B
Swift
9 lines
330 B
Swift
// RUN: %target-swift-frontend %s -O -emit-sil -import-objc-header %S/Inputs/keypaths_objc.h
|
|
// RUN: %target-swift-frontend %s -O -emit-sil -enable-sil-opaque-values -import-objc-header %S/Inputs/keypaths_objc.h
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
public func test_nocrash_rdar34913689() {
|
|
_ = \ObjCFoo.objcExtraProp
|
|
}
|