Files
swift-mirror/test/SILOptimizer/dead_func_objc_extension_keypath.swift
Elsa Keirouz 5b5d6487dc [Opaque Values] Add KeyPath support to the SIL pipeline
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.
2026-06-24 14:55:21 +01:00

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
}