Files
swift-mirror/test/SILGen/afd_static_method.swift
Elsa Keirouz a2ba4bc040 [Opaque Values] test addressable parameters under opaque values
Replace the "not --crash" RUN lines on the addressable tests with RUN lines
that must succeed under -enable-sil-opaque-values, both through SILGen and,
where the test allows it, through the full mandatory pipeline.

Remove XFAILs that now pass.

Add address_lowering_addressable_params.swift. It checks that the caller's
buffer and a callee's incoming address are what reach a call, and that the
address of a read access that has ended before the call is not forwarded.
2026-10-27 19:47:04 +00:00

49 lines
2.0 KiB
Swift

// RUN: %target-swift-emit-silgen-ossa -o /dev/null -enable-sil-opaque-values -enable-experimental-feature Lifetimes -enable-experimental-feature AddressableTypes -module-name main %s
// RUN: %target-swift-emit-sil -sil-verify-all -o /dev/null -enable-sil-opaque-values -enable-experimental-feature Lifetimes -enable-experimental-feature AddressableTypes -module-name main %s
// RUN: %target-swift-emit-silgen -enable-experimental-feature Lifetimes -enable-experimental-feature AddressableTypes -module-name main %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-sil -verify -enable-experimental-feature Lifetimes -enable-experimental-feature AddressableTypes -module-name main %s
// REQUIRES: swift_feature_Lifetimes
// REQUIRES: swift_feature_AddressableTypes
// Ensure that address dependencies are properly lowered
// through static method calls in the same way they are for free function
// calls.
@_addressableForDependencies
struct Owner: ~Copyable {}
// CHECK-LABEL: sil{{.*}} @$s{{.*}}10wrapStatic
// CHECK: bb0([[OWNER:%.*]] : $*Owner):
@_lifetime(borrow owner)
func wrapStatic(_ owner: borrowing Owner) -> View {
// CHECK: [[MARK:%.*]] = mark_unresolved_non_copyable_value [no_consume_or_assign] [[OWNER]]
// CHECK: [[METHOD:%.*]] = function_ref @$s{{.*}}4ViewV4into
// CHECK: apply [[METHOD]]([[MARK]],
return View.into(owner)
}
// CHECK-LABEL: sil{{.*}} @$s{{.*}}8wrapFree
// CHECK: bb0([[OWNER:%.*]] : $*Owner):
@_lifetime(borrow owner)
func wrapFree(_ owner: borrowing Owner) -> View {
// CHECK: [[MARK:%.*]] = mark_unresolved_non_copyable_value [no_consume_or_assign] [[OWNER]]
// CHECK: [[METHOD:%.*]] = function_ref @$s{{.*}}8viewInto
// CHECK: apply [[METHOD]]([[MARK]])
return viewInto(owner)
}
@_lifetime(borrow owner)
func viewInto(_ owner: borrowing Owner) -> View {
fatalError()
}
struct View: ~Escapable {
@_lifetime(borrow owner)
static func into(_ owner: borrowing Owner) -> View {
fatalError()
}
}