Files
swift-mirror/test/ModuleInterface/back-deploy-attr.swift
Allan Shortlidge b860e762b2 AST: Introduce the @_backDeploy function attribute:
- Parse the attribute and diagnose parsing issues
- Serialize the attribute
2022-02-08 10:11:04 -08:00

41 lines
1.6 KiB
Swift

// RUN: %empty-directory(%t)
// Ensure @_backDeploy attributes and function bodies are printed in
// swiftinterface files.
// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/Test.swiftinterface -module-name Test %s
// RUN: %FileCheck %s --check-prefix FROMSOURCE --check-prefix CHECK < %t/Test.swiftinterface
// Ensure @_backDeploy attributes and function bodies are present after
// deserializing .swiftmodule files.
// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -disable-objc-attr-requires-foundation-module -emit-module-interface-path %t/TestFromModule.swiftinterface -module-name Test
// RUN: %FileCheck %s --check-prefix FROMMODULE --check-prefix CHECK < %t/TestFromModule.swiftinterface
// FIXME(backDeploy): Verify that function bodies are emitted
public struct TopLevelStruct {
// CHECK: @_backDeploy(macOS 11.0)
// CHECK: public func backDeployedFunc1_SinglePlatform() -> Swift.Int
@available(macOS 12.0, *)
@_backDeploy(macOS 11.0)
public func backDeployedFunc1_SinglePlatform() -> Int {
return 42
}
// CHECK: @_backDeploy(macOS 11.0)
// CHECK: @_backDeploy(iOS 14.0)
// CHECK: public func backDeployedFunc2_MultiPlatform() -> Swift.Int
@available(macOS 12.0, *)
@_backDeploy(macOS 11.0, iOS 14.0)
public func backDeployedFunc2_MultiPlatform() -> Int {
return 43
}
}
// CHECK: @_backDeploy(macOS 11.0)
// CHECK: public func backDeployTopLevelFunc() -> Swift.Int
@available(macOS 12.0, *)
@_backDeploy(macOS 11.0)
public func backDeployTopLevelFunc() -> Int {
return 42
}