Files
swift-mirror/test/SILGen/preconcurrency-abi-safe-conversions.swift
Joe Groff b781005c0a SILGen: Reabstract subexpr lvalue before ABISafeConversion.
Fixes rdar://130016855. When preconcurrency compatibility introduces
implicit `@Sendable` conversions, the `ABISafeConversionExpr` representing
that conversion indicates an ABI-neutral conversion from the substituted
type of the original expression, so we need to reabstract in cases
where the original property is more generic than the type we're working
with.
2024-07-11 18:49:35 -07:00

26 lines
703 B
Swift

// RUN: %target-swift-emit-silgen -swift-version 5 -verify %s
// RUN: %target-swift-emit-silgen -swift-version 6 -verify %s
struct Text {
init<S>(_: S) where S: StringProtocol {}
}
// In Swift 5, we introduce an implicit @Sendable on the closures here.
// Make sure that doing so doesn't disrupt SILGen's lvalue emission.
// rdar://130016855
public struct Header<TitleContent> {
@preconcurrency
private let titleContent: @MainActor () -> TitleContent
init(title: String) where TitleContent == Text {
self.titleContent = {
Text(title)
}
}
func testGet() -> @MainActor () -> Text
where TitleContent == Text {
return titleContent // expected-warning * {{}}
}
}