mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Prevent #if in @abi in module interfaces
When a language feature is used inside an `@abi` attribute, we should behave as though it was used on its counterpart. This was already half-implemented—we ensured the counterpart would use the feature—but we didn’t make the ABI decl aware that the counterpart was its parent for feature detection purposes. As a result, we would print `#if` inside the `@abi` attribute, which isn’t valid.
This commit is contained in:
@@ -85,6 +85,20 @@ public struct MutatingTest {
|
||||
@abi(func abiSpiFunc())
|
||||
@_spi(spiGroup) public func abiSpiFunc() {}
|
||||
|
||||
// We should print feature guards outside, but not inside, an @abi attribute.
|
||||
@abi(func sendingABI() -> sending Any?)
|
||||
public func sendingABI() -> Any? { nil }
|
||||
// CHECK: #if {{.*}} && $ABIAttribute
|
||||
// CHECK: @abi(func sendingABI() -> sending Any?)
|
||||
// CHECK: public func sendingABI() -> Any?
|
||||
// CHECK: #elseif {{.*}} && $SendingArgsAndResults
|
||||
// CHECK: @_silgen_name("$s5attrs10sendingABIypSgyF")
|
||||
// CHECK: public func sendingABI() -> Any?
|
||||
// CHECK: #else
|
||||
// CHECK: @_silgen_name("$s5attrs10sendingABIypSgyF")
|
||||
// CHECK: public func sendingABI() -> Any?
|
||||
// CHECK: #endif
|
||||
|
||||
@concurrent
|
||||
public func testExecutionConcurrent() async {}
|
||||
// CHECK: @concurrent public func testExecutionConcurrent() async
|
||||
|
||||
Reference in New Issue
Block a user