Files
swift-mirror/test/Interop/Cxx/operators/subscripts-silgen.swift
John Hui 04bea3a464 [cxx-interop] [test] Move subscript tests to operator subdirectory
These were previously in the class/inheritance subdirectory and tested
a handful of subscript inheritance scenarios, but the test coverage
should be expanded and consolidated with the subscript tests currently
in operator/members-inline*.
2026-03-31 17:37:23 -07:00

16 lines
732 B
Swift

// RUN: %target-swift-emit-sil -I %S/Inputs -enable-experimental-cxx-interop %s -validate-tbd-against-ir=none | %FileCheck %s
import Subscripts
func testGetX() -> CInt {
let derived = CopyTrackedDerivedClass(42)
return derived[0]
}
let _ = testGetX()
// CHECK: sil shared [transparent] @$sSo23CopyTrackedDerivedClassVys5Int32VADcig : $@convention(method) (Int32, @in_guaranteed CopyTrackedDerivedClass) -> Int32
// CHECK: {{.*}}(%[[INT_VAL:.*]] : $Int32, %[[SELF_VAL:.*]] : $*CopyTrackedDerivedClass):
// CHECK: function_ref @{{.*}}__synthesizedBaseCall_operatorSubscript{{.*}} : $@convention(cxx_method) (Int32, @in_guaranteed CopyTrackedDerivedClass) -> Int32
// CHECK-NEXT: apply %{{.*}}(%[[INT_VAL]], %[[SELF_VAL]])