NFC: Update tests to use accepted spelling for @backDeployed.

This commit is contained in:
Allan Shortlidge
2023-01-31 23:54:09 -08:00
parent d2524a6de8
commit 022abe4d3b
21 changed files with 188 additions and 180 deletions

View File

@@ -92,6 +92,7 @@ actor MyGlobalActor {
// KEYWORD2-NEXT: Keyword/None: noDerivative[#Func Attribute#]; name=noDerivative // KEYWORD2-NEXT: Keyword/None: noDerivative[#Func Attribute#]; name=noDerivative
// KEYWORD2-NEXT: Keyword/None: Sendable[#Func Attribute#]; name=Sendable // KEYWORD2-NEXT: Keyword/None: Sendable[#Func Attribute#]; name=Sendable
// KEYWORD2-NEXT: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency // KEYWORD2-NEXT: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency
// KEYWORD2-NEXT: Keyword/None: backDeployed[#Func Attribute#]; name=backDeployed
// KEYWORD2-NOT: Keyword // KEYWORD2-NOT: Keyword
// KEYWORD2-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // KEYWORD2-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// KEYWORD2-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#MyPropertyWrapper#]; name=MyPropertyWrapper // KEYWORD2-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#MyPropertyWrapper#]; name=MyPropertyWrapper
@@ -241,6 +242,7 @@ struct _S {
// ON_METHOD-DAG: Keyword/None: Sendable[#Func Attribute#]; name=Sendable // ON_METHOD-DAG: Keyword/None: Sendable[#Func Attribute#]; name=Sendable
// ON_METHOD-DAG: Keyword/None: noDerivative[#Func Attribute#]; name=noDerivative // ON_METHOD-DAG: Keyword/None: noDerivative[#Func Attribute#]; name=noDerivative
// ON_METHOD-DAG: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency // ON_METHOD-DAG: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency
// ON_METHOD-DAG: Keyword/None: backDeployed[#Func Attribute#]; name=backDeployed
// ON_METHOD-NOT: Keyword // ON_METHOD-NOT: Keyword
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct // ON_METHOD-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#MyPropertyWrapper#]; name=MyPropertyWrapper // ON_METHOD-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#MyPropertyWrapper#]; name=MyPropertyWrapper

View File

@@ -10,7 +10,7 @@
//--- Library.swift //--- Library.swift
@available(macOS 10.50, *) @available(macOS 10.50, *)
@_backDeploy(before: macOS 10.60) @backDeployed(before: macOS 10.60)
public func backDeployedFunc() {} public func backDeployedFunc() {}
//--- Client.swift //--- Client.swift

View File

@@ -6,36 +6,37 @@
// RUN: %FileCheck %s < %t/Test.swiftinterface // RUN: %FileCheck %s < %t/Test.swiftinterface
public struct TopLevelStruct { public struct TopLevelStruct {
// TODO: Print `@backDeployed` in swiftinterfaces (rdar://104920183)
// CHECK: @_backDeploy(before: macOS 12.0) // CHECK: @_backDeploy(before: macOS 12.0)
// CHECK: public func backDeployedFunc_SinglePlatform() -> Swift.Int { return 42 } // CHECK: public func backDeployedFunc_SinglePlatform() -> Swift.Int { return 42 }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedFunc_SinglePlatform() -> Int { return 42 } public func backDeployedFunc_SinglePlatform() -> Int { return 42 }
// CHECK: @_backDeploy(before: macOS 12.0, iOS 15.0) // CHECK: @_backDeploy(before: macOS 12.0, iOS 15.0)
// CHECK: public func backDeployedFunc_MultiPlatform() -> Swift.Int { return 43 } // CHECK: public func backDeployedFunc_MultiPlatform() -> Swift.Int { return 43 }
@_backDeploy(before: macOS 12.0, iOS 15.0) @backDeployed(before: macOS 12.0, iOS 15.0)
public func backDeployedFunc_MultiPlatform() -> Int { return 43 } public func backDeployedFunc_MultiPlatform() -> Int { return 43 }
// CHECK: @_backDeploy(before: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0) // CHECK: @_backDeploy(before: macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0)
// CHECK: public func backDeployedFunc_MultiPlatformSeparate() -> Swift.Int { return 43 } // CHECK: public func backDeployedFunc_MultiPlatformSeparate() -> Swift.Int { return 43 }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
@_backDeploy(before: iOS 15.0) @backDeployed(before: iOS 15.0)
@_backDeploy(before: watchOS 8.0) @backDeployed(before: watchOS 8.0)
@_backDeploy(before: tvOS 15.0) @backDeployed(before: tvOS 15.0)
public func backDeployedFunc_MultiPlatformSeparate() -> Int { return 43 } public func backDeployedFunc_MultiPlatformSeparate() -> Int { return 43 }
// CHECK: @_backDeploy(before: macOS 12.0) // CHECK: @_backDeploy(before: macOS 12.0)
// CHECK: public var backDeployedComputedProperty: Swift.Int { // CHECK: public var backDeployedComputedProperty: Swift.Int {
// CHECK: get { 44 } // CHECK: get { 44 }
// CHECK: } // CHECK: }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var backDeployedComputedProperty: Int { 44 } public var backDeployedComputedProperty: Int { 44 }
// CHECK: @_backDeploy(before: macOS 12.0) // CHECK: @_backDeploy(before: macOS 12.0)
// CHECK: public var backDeployedPropertyWithAccessors: Swift.Int { // CHECK: public var backDeployedPropertyWithAccessors: Swift.Int {
// CHECK: get { 45 } // CHECK: get { 45 }
// CHECK: } // CHECK: }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var backDeployedPropertyWithAccessors: Int { public var backDeployedPropertyWithAccessors: Int {
get { 45 } get { 45 }
} }
@@ -44,7 +45,7 @@ public struct TopLevelStruct {
// CHECK: public subscript(index: Swift.Int) -> Swift.Int { // CHECK: public subscript(index: Swift.Int) -> Swift.Int {
// CHECK: get { 46 } // CHECK: get { 46 }
// CHECK: } // CHECK: }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public subscript(index: Int) -> Int { public subscript(index: Int) -> Int {
get { 46 } get { 46 }
} }
@@ -52,17 +53,17 @@ public struct TopLevelStruct {
// CHECK: @_backDeploy(before: macOS 12.0) // CHECK: @_backDeploy(before: macOS 12.0)
// CHECK: public func backDeployTopLevelFunc1() -> Swift.Int { return 47 } // CHECK: public func backDeployTopLevelFunc1() -> Swift.Int { return 47 }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployTopLevelFunc1() -> Int { return 47 } public func backDeployTopLevelFunc1() -> Int { return 47 }
// MARK: - Availability macros // MARK: - Availability macros
// CHECK: @_backDeploy(before: macOS 12.1) // CHECK: @_backDeploy(before: macOS 12.1)
// CHECK: public func backDeployTopLevelFunc2() -> Swift.Int { return 48 } // CHECK: public func backDeployTopLevelFunc2() -> Swift.Int { return 48 }
@_backDeploy(before: _macOS12_1) @backDeployed(before: _macOS12_1)
public func backDeployTopLevelFunc2() -> Int { return 48 } public func backDeployTopLevelFunc2() -> Int { return 48 }
// CHECK: @_backDeploy(before: macOS 12.1, iOS 15.1) // CHECK: @_backDeploy(before: macOS 12.1, iOS 15.1)
// CHECK: public func backDeployTopLevelFunc3() -> Swift.Int { return 49 } // CHECK: public func backDeployTopLevelFunc3() -> Swift.Int { return 49 }
@_backDeploy(before: _myProject 1.0) @backDeployed(before: _myProject 1.0)
public func backDeployTopLevelFunc3() -> Int { return 49 } public func backDeployTopLevelFunc3() -> Int { return 49 }

View File

@@ -6,13 +6,13 @@
// REQUIRES: OS=macosx // REQUIRES: OS=macosx
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func someFunc() {} public func someFunc() {}
public struct S<T> { public struct S<T> {
@usableFromInline var _x: T @usableFromInline var _x: T
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public var x: T { public var x: T {
get { _x } get { _x }
set { _x = newValue } set { _x = newValue }
@@ -59,7 +59,7 @@ func aeicCaller(_ s: inout S<Z>) {
} }
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy0A14DeployedCalleryyAA1SVyAA1ZVGzFTwB // CHECK-LABEL: sil non_abi [serialized] [ossa] @$s11back_deploy0A14DeployedCalleryyAA1SVyAA1ZVGzFTwB
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func backDeployedCaller(_ s: inout S<Z>) { public func backDeployedCaller(_ s: inout S<Z>) {
// CHECK: function_ref @$s11back_deploy8someFuncyyFTwb : $@convention(thin) () -> () // CHECK: function_ref @$s11back_deploy8someFuncyyFTwb : $@convention(thin) () -> ()
someFunc() someFunc()

View File

@@ -35,7 +35,7 @@ public struct TopLevelStruct {
// -- Original definition of TopLevelStruct.property.getter // -- Original definition of TopLevelStruct.property.getter
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvg : $@convention(method) (TopLevelStruct) -> TopLevelStruct // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvg : $@convention(method) (TopLevelStruct) -> TopLevelStruct
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public var property: TopLevelStruct { self } public var property: TopLevelStruct { self }
} }

View File

@@ -62,7 +62,7 @@ public struct TopLevelStruct {
// -- Original definition of TopLevelStruct.property.read // -- Original definition of TopLevelStruct.property.read
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvr : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV8propertyACvr : $@yield_once @convention(method) (TopLevelStruct) -> @yields TopLevelStruct
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public var property: TopLevelStruct { public var property: TopLevelStruct {
_read { yield self } _read { yield self }
} }

View File

@@ -43,7 +43,7 @@
// -- Original definition of trivialFunc() // -- Original definition of trivialFunc()
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy9asyncFuncyyYaF : $@convention(thin) @async () -> () // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy9asyncFuncyyYaF : $@convention(thin) @async () -> ()
@available(macOS 10.51, *) @available(macOS 10.51, *)
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func asyncFunc() async { public func asyncFunc() async {
await otherFunc() await otherFunc()
} }

View File

@@ -36,7 +36,7 @@
// -- Original definition of trivialFunc() // -- Original definition of trivialFunc()
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11trivialFuncyyF : $@convention(thin) () -> () // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11trivialFuncyyF : $@convention(thin) () -> ()
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func trivialFunc() {} public func trivialFunc() {}
// -- Fallback definition of isNumber(_:) // -- Fallback definition of isNumber(_:)
@@ -70,7 +70,7 @@ public func trivialFunc() {}
// -- Original definition of isNumber(_:) // -- Original definition of isNumber(_:)
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy8isNumberySbSiF : $@convention(thin) (Int) -> Bool // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy8isNumberySbSiF : $@convention(thin) (Int) -> Bool
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func isNumber(_ x: Int) -> Bool { public func isNumber(_ x: Int) -> Bool {
return true return true
} }

View File

@@ -37,7 +37,7 @@
// -- Original definition of genericFunc(_:) // -- Original definition of genericFunc(_:)
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11genericFuncyxxlF : $@convention(thin) <T> (@in_guaranteed T) -> @out T // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy11genericFuncyxxlF : $@convention(thin) <T> (@in_guaranteed T) -> @out T
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func genericFunc<T>(_ t: T) -> T { public func genericFunc<T>(_ t: T) -> T {
return t return t
} }
@@ -76,7 +76,7 @@ public func genericFunc<T>(_ t: T) -> T {
// -- Original definition of genericFuncWithOwnedParam(_:) // -- Original definition of genericFuncWithOwnedParam(_:)
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy25genericFuncWithOwnedParamyyxnlF : $@convention(thin) <T> (@in T) -> () // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy25genericFuncWithOwnedParamyyxnlF : $@convention(thin) <T> (@in T) -> ()
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func genericFuncWithOwnedParam<T>(_ t: __owned T) { } public func genericFuncWithOwnedParam<T>(_ t: __owned T) { }
struct S {} struct S {}

View File

@@ -56,7 +56,7 @@ public struct TopLevelStruct<T> {
// -- Original definition of TopLevelStruct.init(_:) // -- Original definition of TopLevelStruct.init(_:)
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructVyACyxGxcfC : $@convention(method) <T> (@in T, @thin TopLevelStruct<T>.Type) -> @out TopLevelStruct<T> // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructVyACyxGxcfC : $@convention(method) <T> (@in T, @thin TopLevelStruct<T>.Type) -> @out TopLevelStruct<T>
@available(macOS 10.51, *) @available(macOS 10.51, *)
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public init(_ t: T) { public init(_ t: T) {
self.t = t self.t = t
} }

View File

@@ -37,7 +37,7 @@ public struct TopLevelStruct {
// -- Original definition of TopLevelStruct.trivialMethod() // -- Original definition of TopLevelStruct.trivialMethod()
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyF : $@convention(method) (TopLevelStruct) -> () // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy14TopLevelStructV13trivialMethodyyF : $@convention(method) (TopLevelStruct) -> ()
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func trivialMethod() {} public func trivialMethod() {}
} }

View File

@@ -49,7 +49,7 @@
// -- Original definition of throwingFunc() // -- Original definition of throwingFunc()
// CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy12throwingFuncyyKF : $@convention(thin) () -> @error any Error // CHECK-LABEL: sil [available 10.52] [ossa] @$s11back_deploy12throwingFuncyyKF : $@convention(thin) () -> @error any Error
@_backDeploy(before: macOS 10.52) @backDeployed(before: macOS 10.52)
public func throwingFunc() throws {} public func throwingFunc() throws {}
// CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyKF : $@convention(thin) () -> @error any Error // CHECK-LABEL: sil hidden [ossa] @$s11back_deploy6calleryyKF : $@convention(thin) () -> @error any Error

View File

@@ -643,5 +643,5 @@ func giveKeyPathString() {
// CHECK-NOT: {{bb[0-9]+}}({{%[^,]+}} : @owned $τ_0_0): // CHECK-NOT: {{bb[0-9]+}}({{%[^,]+}} : @owned $τ_0_0):
// CHECK-LABEL: } // end sil function '$s20opaque_values_silgen29backDeployingReturningGenericyxxKlFTwb' // CHECK-LABEL: } // end sil function '$s20opaque_values_silgen29backDeployingReturningGenericyxxKlFTwb'
@available(SwiftStdlib 5.1, *) @available(SwiftStdlib 5.1, *)
@_backDeploy(before: SwiftStdlib 5.8) @backDeployed(before: SwiftStdlib 5.8)
public func backDeployingReturningGeneric<T>(_ t: T) throws -> T { t } public func backDeployingReturningGeneric<T>(_ t: T) throws -> T { t }

View File

@@ -96,15 +96,15 @@ public func forbidMacrosInInlinableCode1() {
} }
} }
@_backDeploy(before: _iOS9Aligned) @backDeployed(before: _iOS9Aligned)
public func forbidMacrosInInlinableCode2() { public func forbidMacrosInInlinableCode2() {
if #available(_iOS9Aligned, *) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #available(_iOS9Aligned, *) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
if #available(_iOS9, _macOS10_11, *) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #available(_iOS9, _macOS10_11, *) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
if #available(iOS 9.0, _macOS10_11, tvOS 9.0, *) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #available(iOS 9.0, _macOS10_11, tvOS 9.0, *) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
if #unavailable(_iOS9Aligned) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #unavailable(_iOS9Aligned) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
if #unavailable(_iOS9, _macOS10_11) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #unavailable(_iOS9, _macOS10_11) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
if #unavailable(iOS 9.0, _macOS10_11, tvOS 9.0) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #unavailable(iOS 9.0, _macOS10_11, tvOS 9.0) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
doIt { doIt {
if #available(_iOS9Aligned, *) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}} if #available(_iOS9Aligned, *) { } // expected-error {{availability macro cannot be used in a '@backDeployed' function}}
} }
} }

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -parse-as-library -enable-library-evolution -emit-module -module-name Test -experimental-skip-non-inlinable-function-bodies %s // RUN: %target-swift-frontend -parse-as-library -enable-library-evolution -emit-module -module-name Test -experimental-skip-non-inlinable-function-bodies %s
@_backDeploy(before: SwiftStdlib 5.7) @backDeployed(before: SwiftStdlib 5.7)
public func foo() {} public func foo() {}

View File

@@ -94,20 +94,20 @@ extension ReferenceIntArray: Countable {
#if !STRIP_V2_APIS #if !STRIP_V2_APIS
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func trivial() { public func trivial() {
testPrint(handle: #dsohandle, "trivial") testPrint(handle: #dsohandle, "trivial")
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func pleaseThrow(_ shouldThrow: Bool) throws -> Bool { public func pleaseThrow(_ shouldThrow: Bool) throws -> Bool {
if shouldThrow { throw BadError.bad } if shouldThrow { throw BadError.bad }
return !shouldThrow return !shouldThrow
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func genericAppend<T: Appendable>( public func genericAppend<T: Appendable>(
_ a: inout T, _ a: inout T,
_ x: __owned T.Element _ x: __owned T.Element
@@ -116,37 +116,37 @@ public func genericAppend<T: Appendable>(
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func existentialCount(_ c: any Countable) -> Int { public func existentialCount(_ c: any Countable) -> Int {
c.count c.count
} }
extension IntArray { extension IntArray {
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public var values: [Int] { _values } public var values: [Int] { _values }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public init() { self.init([]) } public init() { self.init([]) }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func print() { public func print() {
// Tests recursive @_backDeploy since `Array.print()` is also @_backDeploy // Tests recursive @backDeployed since `Array.print()` is also @backDeployed
_values.print() _values.print()
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public static var empty: Self { IntArray([]) } public static var empty: Self { IntArray([]) }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func toCountable() -> any Countable { self } public func toCountable() -> any Countable { self }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
@inlinable @inlinable
public subscript(_ i: Int) -> Int { public subscript(_ i: Int) -> Int {
get { _values[i] } get { _values[i] }
@@ -154,13 +154,13 @@ extension IntArray {
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public var rawValues: [Int] { public var rawValues: [Int] {
_read { yield _values } _read { yield _values }
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public mutating func removeLast() -> Int? { public mutating func removeLast() -> Int? {
defer { _values.removeLast() } defer { _values.removeLast() }
return _values.last return _values.last
@@ -169,36 +169,36 @@ extension IntArray {
extension ReferenceIntArray { extension ReferenceIntArray {
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public convenience init() { self.init([]) } public convenience init() { self.init([]) }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final var values: [Int] { _values } public final var values: [Int] { _values }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final func print() { public final func print() {
// Tests recursive @_backDeploy since `Array.print()` is also @_backDeploy // Tests recursive @backDeployed since `Array.print()` is also @backDeployed
_values.print() _values.print()
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final func copy() -> ReferenceIntArray { public final func copy() -> ReferenceIntArray {
return ReferenceIntArray(values) return ReferenceIntArray(values)
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final class var empty: ReferenceIntArray { ReferenceIntArray([]) } public final class var empty: ReferenceIntArray { ReferenceIntArray([]) }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final func toCountable() -> any Countable { self } public final func toCountable() -> any Countable { self }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
@inlinable @inlinable
public final subscript(_ i: Int) -> Int { public final subscript(_ i: Int) -> Int {
get { _values[i] } get { _values[i] }
@@ -206,13 +206,13 @@ extension ReferenceIntArray {
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final var rawValues: [Int] { public final var rawValues: [Int] {
_read { yield _values } _read { yield _values }
} }
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public final func removeLast() -> Int? { public final func removeLast() -> Int? {
defer { _values.removeLast() } defer { _values.removeLast() }
return _values.last return _values.last
@@ -221,7 +221,7 @@ extension ReferenceIntArray {
extension Array { extension Array {
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public func print() { public func print() {
testPrint(handle: #dsohandle, description) testPrint(handle: #dsohandle, description)
} }
@@ -229,7 +229,7 @@ extension Array {
extension BadError { extension BadError {
@available(BackDeploy 1.0, *) @available(BackDeploy 1.0, *)
@_backDeploy(before: BackDeploy 2.0) @backDeployed(before: BackDeploy 2.0)
public init?(fromEmoji emoji: Character) { public init?(fromEmoji emoji: Character) {
switch emoji { switch emoji {
case "❗️": self = .bad case "❗️": self = .bad

View File

@@ -4,45 +4,45 @@
// MARK: - Valid declarations // MARK: - Valid declarations
// Ok, top level functions // Ok, top level functions
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedTopLevelFunc() {} public func backDeployedTopLevelFunc() {}
// Ok, internal decls may be back deployed when @usableFromInline // Ok, internal decls may be back deployed when @usableFromInline
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
@usableFromInline @usableFromInline
internal func backDeployedUsableFromInlineTopLevelFunc() {} internal func backDeployedUsableFromInlineTopLevelFunc() {}
// Ok, decls in a struct // Ok, decls in a struct
public struct TopLevelStruct { public struct TopLevelStruct {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public init<T>(_ t: T) {} public init<T>(_ t: T) {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedMethod() {} public func backDeployedMethod() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var backDeployedComputedProperty: Int { 98 } public var backDeployedComputedProperty: Int { 98 }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public subscript(_ index: Int) -> Int { index } public subscript(_ index: Int) -> Int { index }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var readWriteProperty: Int { public var readWriteProperty: Int {
get { 42 } get { 42 }
set(newValue) {} set(newValue) {}
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public subscript(at index: Int) -> Int { public subscript(at index: Int) -> Int {
get { 42 } get { 42 }
set(newValue) {} set(newValue) {}
} }
public var explicitReadAndModify: Int { public var explicitReadAndModify: Int {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
_read { yield 42 } _read { yield 42 }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
_modify {} _modify {}
} }
} }
@@ -51,7 +51,7 @@ public struct TopLevelStruct {
public enum TopLevelEnum { public enum TopLevelEnum {
case a, b case a, b
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public init?(from name: String) { public init?(from name: String) {
switch name { switch name {
case "a": self = .a case "a": self = .a
@@ -60,10 +60,10 @@ public enum TopLevelEnum {
} }
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedMethod() {} public func backDeployedMethod() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var name: String { public var name: String {
switch self { switch self {
case .a: return "a" case .a: return "a"
@@ -80,29 +80,29 @@ public class TopLevelClass {
self.x = x self.x = x
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public convenience init() { public convenience init() {
self.init(x: 1) self.init(x: 1)
} }
public func hook() {} public func hook() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public func backDeployedFinalMethod() {} final public func backDeployedFinalMethod() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public var backDeployedFinalComputedProperty: Int { 98 } final public var backDeployedFinalComputedProperty: Int { 98 }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public static func backDeployedStaticMethod() {} public static func backDeployedStaticMethod() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public final class func backDeployedClassMethod() {} public final class func backDeployedClassMethod() {}
} }
// Ok, final decls in a non-final, derived class // Ok, final decls in a non-final, derived class
public class DerivedTopLevelClass: TopLevelClass { public class DerivedTopLevelClass: TopLevelClass {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public func backDeployedFinalMethodOnDerived() {} final public func backDeployedFinalMethodOnDerived() {}
} }
@@ -114,15 +114,15 @@ final public class FinalTopLevelClass {
self.x = x self.x = x
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public convenience init() { public convenience init() {
self.init(x: 1) self.init(x: 1)
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedMethod() {} public func backDeployedMethod() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var backDeployedComputedProperty: Int { 98 } public var backDeployedComputedProperty: Int { 98 }
} }
@@ -135,15 +135,15 @@ public actor TopLevelActor {
self.x = x self.x = x
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public init() { public init() {
self.init(x: 1) self.init(x: 1)
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public func method() {} final public func method() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public var computedProperty: Int { 98 } final public var computedProperty: Int { 98 }
} }
@@ -156,107 +156,107 @@ final public actor FinalTopLevelActor {
self.x = x self.x = x
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public init() { public init() {
self.init(x: 1) self.init(x: 1)
} }
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func method() {} public func method() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public var computedProperty: Int { 98 } public var computedProperty: Int { 98 }
} }
// Ok, decls in extensions of public types // Ok, decls in extensions of public types
extension TopLevelStruct { extension TopLevelStruct {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {} public func backDeployedExtensionMethod() {}
} }
extension TopLevelClass { extension TopLevelClass {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public func backDeployedExtensionMethod() {} final public func backDeployedExtensionMethod() {}
} }
extension FinalTopLevelClass { extension FinalTopLevelClass {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {} public func backDeployedExtensionMethod() {}
} }
@available(SwiftStdlib 5.1, *) @available(SwiftStdlib 5.1, *)
extension TopLevelActor { extension TopLevelActor {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
final public func backDeployedExtensionMethod() {} final public func backDeployedExtensionMethod() {}
} }
@available(SwiftStdlib 5.1, *) @available(SwiftStdlib 5.1, *)
extension FinalTopLevelActor { extension FinalTopLevelActor {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {} public func backDeployedExtensionMethod() {}
} }
public protocol TopLevelProtocol {} public protocol TopLevelProtocol {}
extension TopLevelProtocol { extension TopLevelProtocol {
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {} public func backDeployedExtensionMethod() {}
} }
// MARK: - Unsupported declaration kinds // MARK: - Unsupported declaration kinds
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
public class CannotBackDeployClass {} public class CannotBackDeployClass {}
public class CannotBackDeployClassDesignatedInit { public class CannotBackDeployClassDesignatedInit {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' cannot be applied to a non-final initializer}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final initializer}}
public init(x: Int) {} public init(x: Int) {}
} }
public final class CannotBackDeployClassDeinit { public final class CannotBackDeployClassDeinit {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to deinitializer declarations}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to deinitializer declarations}}
deinit {} deinit {}
} }
// Ok, final decls in a non-final, derived class // Ok, final decls in a non-final, derived class
public class CannotBackDeployOverride: TopLevelClass { public class CannotBackDeployOverride: TopLevelClass {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' cannot be combined with 'override'}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be combined with 'override'}}
final public override func hook() {} final public override func hook() {}
} }
@available(SwiftStdlib 5.1, *) @available(SwiftStdlib 5.1, *)
public actor CannotBackDeployActorDesignatedInit { public actor CannotBackDeployActorDesignatedInit {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' cannot be applied to a non-final initializer}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final initializer}}
public init(x: Int) {} public init(x: Int) {}
} }
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
public struct CannotBackDeployStruct { public struct CannotBackDeployStruct {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' must not be used on stored properties}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on stored properties}}
public var cannotBackDeployStoredProperty: Int = 83 public var cannotBackDeployStoredProperty: Int = 83
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' must not be used on stored properties}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on stored properties}}
public lazy var cannotBackDeployLazyStoredProperty: Int = 15 public lazy var cannotBackDeployLazyStoredProperty: Int = 15
} }
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
public enum CannotBackDeployEnum { public enum CannotBackDeployEnum {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
case cannotBackDeployEnumCase case cannotBackDeployEnumCase
} }
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' must not be used on stored properties}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on stored properties}}
public var cannotBackDeployTopLevelVar = 79 public var cannotBackDeployTopLevelVar = 79
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
extension TopLevelStruct {} extension TopLevelStruct {}
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
protocol CannotBackDeployProtocol {} protocol CannotBackDeployProtocol {}
@available(SwiftStdlib 5.1, *) @available(SwiftStdlib 5.1, *)
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' attribute cannot be applied to this declaration}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' attribute cannot be applied to this declaration}}
public actor CannotBackDeployActor {} public actor CannotBackDeployActor {}
@@ -269,147 +269,152 @@ public struct FunctionBodyDiagnostics {
fileprivate func fileprivateFunc() {} // expected-note {{instance method 'fileprivateFunc()' is not '@usableFromInline' or public}} fileprivate func fileprivateFunc() {} // expected-note {{instance method 'fileprivateFunc()' is not '@usableFromInline' or public}}
private func privateFunc() {} // expected-note {{instance method 'privateFunc()' is not '@usableFromInline' or public}} private func privateFunc() {} // expected-note {{instance method 'privateFunc()' is not '@usableFromInline' or public}}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
public func backDeployedMethod() { public func backDeployedMethod() {
struct Nested {} // expected-error {{type 'Nested' cannot be nested inside a '@_backDeploy' function}} struct Nested {} // expected-error {{type 'Nested' cannot be nested inside a '@backDeployed' function}}
publicFunc() publicFunc()
usableFromInlineFunc() usableFromInlineFunc()
internalFunc() // expected-error {{instance method 'internalFunc()' is internal and cannot be referenced from a '@_backDeploy' function}} internalFunc() // expected-error {{instance method 'internalFunc()' is internal and cannot be referenced from a '@backDeployed' function}}
fileprivateFunc() // expected-error {{instance method 'fileprivateFunc()' is fileprivate and cannot be referenced from a '@_backDeploy' function}} fileprivateFunc() // expected-error {{instance method 'fileprivateFunc()' is fileprivate and cannot be referenced from a '@backDeployed' function}}
privateFunc() // expected-error {{instance method 'privateFunc()' is private and cannot be referenced from a '@_backDeploy' function}} privateFunc() // expected-error {{instance method 'privateFunc()' is private and cannot be referenced from a '@backDeployed' function}}
} }
} }
// MARK: - Incompatible declarations // MARK: - Incompatible declarations
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' may not be used on fileprivate declarations}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on fileprivate declarations}}
fileprivate func filePrivateFunc() {} fileprivate func filePrivateFunc() {}
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' may not be used on private declarations}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on private declarations}}
private func privateFunc() {} private func privateFunc() {}
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' may not be used on internal declarations}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on internal declarations}}
internal func internalFunc() {} internal func internalFunc() {}
private struct PrivateTopLevelStruct { private struct PrivateTopLevelStruct {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' may not be used on private declarations}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' may not be used on private declarations}}
public func effectivelyPrivateFunc() {} public func effectivelyPrivateFunc() {}
} }
public class TopLevelClass2 { public class TopLevelClass2 {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' cannot be applied to a non-final instance method}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final instance method}}
public func nonFinalMethod() {} public func nonFinalMethod() {}
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' cannot be applied to a non-final class method}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' cannot be applied to a non-final class method}}
public class func nonFinalClassMethod() {} public class func nonFinalClassMethod() {}
} }
@_backDeploy(before: macOS 12.0, macOS 13.0) // expected-error {{'@_backDeploy' contains multiple versions for macOS}} @backDeployed(before: macOS 12.0, macOS 13.0) // expected-error {{'@backDeployed' contains multiple versions for macOS}}
public func duplicatePlatformsFunc1() {} public func duplicatePlatformsFunc1() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
@_backDeploy(before: macOS 13.0) // expected-error {{'@_backDeploy' contains multiple versions for macOS}} @backDeployed(before: macOS 13.0) // expected-error {{'@backDeployed' contains multiple versions for macOS}}
public func duplicatePlatformsFunc2() {} public func duplicatePlatformsFunc2() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
@_alwaysEmitIntoClient // expected-error {{'@_alwaysEmitIntoClient' cannot be applied to a back deployed global function}} @_alwaysEmitIntoClient // expected-error {{'@_alwaysEmitIntoClient' cannot be applied to a back deployed global function}}
public func alwaysEmitIntoClientFunc() {} public func alwaysEmitIntoClientFunc() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
@inlinable // Ok @inlinable // Ok
public func inlinableFunc() {} public func inlinableFunc() {}
@_backDeploy(before: macOS 12.0) @backDeployed(before: macOS 12.0)
@_transparent // expected-error {{'@_transparent' cannot be applied to a back deployed global function}} @_transparent // expected-error {{'@_transparent' cannot be applied to a back deployed global function}}
public func transparentFunc() {} public func transparentFunc() {}
// MARK: - Attribute parsing // MARK: - Attribute parsing
@_backDeploy(before: macos 12.0, iOS 15.0) // expected-warning {{unknown platform 'macos' for attribute '@_backDeploy'; did you mean 'macOS'?}} {{22-27=macOS}} @backDeployed(before: macos 12.0, iOS 15.0) // expected-warning {{unknown platform 'macos' for attribute '@backDeployed'; did you mean 'macOS'?}} {{23-28=macOS}}
public func incorrectPlatformCaseFunc() {} public func incorrectPlatformCaseFunc() {}
@_backDeploy(before: mscos 12.0, iOS 15.0) // expected-warning {{unknown platform 'mscos' for attribute '@_backDeploy'; did you mean 'macOS'?}} {{22-27=macOS}} @backDeployed(before: mscos 12.0, iOS 15.0) // expected-warning {{unknown platform 'mscos' for attribute '@backDeployed'; did you mean 'macOS'?}} {{23-28=macOS}}
public func incorrectPlatformSimilarFunc() {} public func incorrectPlatformSimilarFunc() {}
@_backDeploy(before: macOS 12.0, unknownOS 1.0) // expected-warning {{unknown platform 'unknownOS' for attribute '@_backDeploy'}} @backDeployed(before: macOS 12.0, unknownOS 1.0) // expected-warning {{unknown platform 'unknownOS' for attribute '@backDeployed'}}
public func unknownOSFunc() {} public func unknownOSFunc() {}
@_backDeploy(before: @) // expected-error {{expected platform in '@_backDeploy' attribute}} @backDeployed(before: @) // expected-error {{expected platform in '@backDeployed' attribute}}
public func badPlatformFunc1() {} public func badPlatformFunc1() {}
@_backDeploy(before: @ 12.0) // expected-error {{expected platform in '@_backDeploy' attribute}} @backDeployed(before: @ 12.0) // expected-error {{expected platform in '@backDeployed' attribute}}
public func badPlatformFunc2() {} public func badPlatformFunc2() {}
@_backDeploy(before: macOS) // expected-error {{expected version number in '@_backDeploy' attribute}} @backDeployed(before: macOS) // expected-error {{expected version number in '@backDeployed' attribute}}
public func missingVersionFunc1() {} public func missingVersionFunc1() {}
@_backDeploy(before: macOS 12.0, iOS) // expected-error {{expected version number in '@_backDeploy' attribute}} @backDeployed(before: macOS 12.0, iOS) // expected-error {{expected version number in '@backDeployed' attribute}}
public func missingVersionFunc2() {} public func missingVersionFunc2() {}
@_backDeploy(before: macOS, iOS) // expected-error 2{{expected version number in '@_backDeploy' attribute}} @backDeployed(before: macOS, iOS) // expected-error 2{{expected version number in '@backDeployed' attribute}}
public func missingVersionFunc3() {} public func missingVersionFunc3() {}
@_backDeploy(before: macOS 12.0, iOS 15.0,) // expected-error {{unexpected ',' separator}} @backDeployed(before: macOS 12.0, iOS 15.0,) // expected-error {{unexpected ',' separator}}
public func unexpectedSeparatorFunc() {} public func unexpectedSeparatorFunc() {}
@_backDeploy(before: macOS 12.0.1) // expected-warning {{'@_backDeploy' only uses major and minor version number}} @backDeployed(before: macOS 12.0.1) // expected-warning {{'@backDeployed' only uses major and minor version number}}
public func patchVersionFunc() {} public func patchVersionFunc() {}
@_backDeploy(before: macOS 12.0, * 9.0) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}} @backDeployed(before: macOS 12.0, * 9.0) // expected-warning {{* as platform name has no effect in '@backDeployed' attribute}}
public func wildcardWithVersionFunc() {} public func wildcardWithVersionFunc() {}
@_backDeploy(before: macOS 12.0, *) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}} @backDeployed(before: macOS 12.0, *) // expected-warning {{* as platform name has no effect in '@backDeployed' attribute}}
public func trailingWildcardFunc() {} public func trailingWildcardFunc() {}
@_backDeploy(before: macOS 12.0, *, iOS 15.0) // expected-warning {{* as platform name has no effect in '@_backDeploy' attribute}} @backDeployed(before: macOS 12.0, *, iOS 15.0) // expected-warning {{* as platform name has no effect in '@backDeployed' attribute}}
public func embeddedWildcardFunc() {} public func embeddedWildcardFunc() {}
@_backDeploy(before: _myProject 3.0) // expected-error {{reference to undefined version '3.0' for availability macro '_myProject'}} @backDeployed(before: _myProject 3.0) // expected-error {{reference to undefined version '3.0' for availability macro '_myProject'}}
public func macroVersioned() {} public func macroVersioned() {}
@_backDeploy(before: _myProject) // expected-error {{reference to undefined version '0' for availability macro '_myProject'}} @backDeployed(before: _myProject) // expected-error {{reference to undefined version '0' for availability macro '_myProject'}}
public func missingMacroVersion() {} public func missingMacroVersion() {}
// Fall back to the default diagnostic when the macro is unknown. // Fall back to the default diagnostic when the macro is unknown.
@_backDeploy(before: _unknownMacro) // expected-warning {{unknown platform '_unknownMacro' for attribute '@_backDeploy'}} @backDeployed(before: _unknownMacro) // expected-warning {{unknown platform '_unknownMacro' for attribute '@backDeployed'}}
// expected-error@-1 {{expected version number in '@_backDeploy' attribute}} // expected-error@-1 {{expected version number in '@backDeployed' attribute}}
public func unknownMacroMissingVersion() {} public func unknownMacroMissingVersion() {}
@_backDeploy(before: _unknownMacro 1.0) // expected-warning {{unknown platform '_unknownMacro' for attribute '@_backDeploy'}} @backDeployed(before: _unknownMacro 1.0) // expected-warning {{unknown platform '_unknownMacro' for attribute '@backDeployed'}}
// expected-error@-1 {{expected at least one platform version in '@_backDeploy' attribute}} // expected-error@-1 {{expected at least one platform version in '@backDeployed' attribute}}
public func unknownMacroVersioned() {} public func unknownMacroVersioned() {}
@_backDeploy(before: _unknownMacro 1.0, _myProject 2.0) // expected-warning {{unknown platform '_unknownMacro' for attribute '@_backDeploy'}} @backDeployed(before: _unknownMacro 1.0, _myProject 2.0) // expected-warning {{unknown platform '_unknownMacro' for attribute '@backDeployed'}}
public func knownAndUnknownMacroVersioned() {} public func knownAndUnknownMacroVersioned() {}
@_backDeploy() // expected-error {{expected 'before:' in '@_backDeploy' attribute}} @backDeployed() // expected-error {{expected 'before:' in '@backDeployed' attribute}}
// expected-error@-1 {{expected at least one platform version in '@_backDeploy' attribute}} // expected-error@-1 {{expected at least one platform version in '@backDeployed' attribute}}
public func emptyAttributeFunc() {} public func emptyAttributeFunc() {}
@_backDeploy(macOS 12.0) // expected-error {{expected 'before:' in '@_backDeploy' attribute}} {{14-14=before:}} @backDeployed(macOS 12.0) // expected-error {{expected 'before:' in '@backDeployed' attribute}} {{15-15=before:}}
public func missingBeforeFunc() {} public func missingBeforeFunc() {}
@_backDeploy(before) // expected-error {{expected ':' after 'before' in '@_backDeploy' attribute}} {{20-20=:}} @backDeployed(before) // expected-error {{expected ':' after 'before' in '@backDeployed' attribute}} {{21-21=:}}
// expected-error@-1 {{expected at least one platform version in '@_backDeploy' attribute}} // expected-error@-1 {{expected at least one platform version in '@backDeployed' attribute}}
public func missingColonAfterBeforeFunc() {} public func missingColonAfterBeforeFunc() {}
@_backDeploy(before macOS 12.0) // expected-error {{expected ':' after 'before' in '@_backDeploy' attribute}} {{20-20=:}} @backDeployed(before macOS 12.0) // expected-error {{expected ':' after 'before' in '@backDeployed' attribute}} {{21-21=:}}
public func missingColonBetweenBeforeAndPlatformFunc() {} public func missingColonBetweenBeforeAndPlatformFunc() {}
@_backDeploy(before: macOS 12.0,) // expected-error {{unexpected ',' separator}} {{32-33=}} @backDeployed(before: macOS 12.0,) // expected-error {{unexpected ',' separator}} {{33-34=}}
public func unexpectedTrailingCommaFunc() {} public func unexpectedTrailingCommaFunc() {}
@_backDeploy(before: macOS 12.0,, iOS 15.0) // expected-error {{unexpected ',' separator}} {{33-34=}} @backDeployed(before: macOS 12.0,, iOS 15.0) // expected-error {{unexpected ',' separator}} {{34-35=}}
public func extraCommaFunc() {} public func extraCommaFunc() {}
@_backDeploy(before:) // expected-error {{expected at least one platform version in '@_backDeploy' attribute}} @backDeployed(before:) // expected-error {{expected at least one platform version in '@backDeployed' attribute}}
public func emptyPlatformVersionsFunc() {} public func emptyPlatformVersionsFunc() {}
@_backDeploy // expected-error {{expected '(' in '@_backDeploy' attribute}} @backDeployed // expected-error {{expected '(' in '@backDeployed' attribute}}
public func expectedLeftParenFunc() {} public func expectedLeftParenFunc() {}
@_backDeploy(before: macOS 12.0 // expected-note {{to match this opening '('}} @backDeployed(before: macOS 12.0 // expected-note {{to match this opening '('}}
public func expectedRightParenFunc() {} // expected-error {{expected ')' in '@_backDeploy' argument list}} public func expectedRightParenFunc() {} // expected-error {{expected ')' in '@backDeployed' argument list}}
// MARK: - Legacy attribute spelling
@_backDeploy(before: macOS 12.0)
public func legacyBackDeployFunc() {}

View File

@@ -2,84 +2,84 @@
// REQUIRES: OS=macosx // REQUIRES: OS=macosx
@_backDeploy(before: macOS 12) // Ok, introduced availability is inferred to be macOS 10.9 @backDeployed(before: macOS 12) // Ok, introduced availability is inferred to be macOS 10.9
public func topLevelFunc() {} public func topLevelFunc() {}
public struct TopLevelStruct { public struct TopLevelStruct {
@_backDeploy(before: macOS 12) // Ok, introduced availability is inferred to be macOS 10.9 @backDeployed(before: macOS 12) // Ok, introduced availability is inferred to be macOS 10.9
public func methodInStruct() {} public func methodInStruct() {}
} }
extension TopLevelStruct { extension TopLevelStruct {
@_backDeploy(before: macOS 12) // Ok, introduced availability is inferred to be macOS 10.9 @backDeployed(before: macOS 12) // Ok, introduced availability is inferred to be macOS 10.9
public func methodInExtension() {} public func methodInExtension() {}
} }
@available(macOS 11, *) @available(macOS 11, *)
@_backDeploy(before: macOS 12) // Ok, introduced availability is earlier than macOS 12 @backDeployed(before: macOS 12) // Ok, introduced availability is earlier than macOS 12
public func availableBeforeBackDeployment() {} public func availableBeforeBackDeployment() {}
@available(macOS 12, *) // expected-note {{'availableSameVersionAsBackDeployment()' was introduced in macOS 12}} @available(macOS 12, *) // expected-note {{'availableSameVersionAsBackDeployment()' was introduced in macOS 12}}
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'availableSameVersionAsBackDeployment()' is not available before macOS 12}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'availableSameVersionAsBackDeployment()' is not available before macOS 12}}
public func availableSameVersionAsBackDeployment() {} public func availableSameVersionAsBackDeployment() {}
@available(macOS 12.1, *) // expected-note {{'availableAfterBackDeployment()' was introduced in macOS 12.1}} @available(macOS 12.1, *) // expected-note {{'availableAfterBackDeployment()' was introduced in macOS 12.1}}
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'availableAfterBackDeployment()' is not available before macOS 12}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'availableAfterBackDeployment()' is not available before macOS 12}}
public func availableAfterBackDeployment() {} public func availableAfterBackDeployment() {}
@available(macOS 12, iOS 13, *) @available(macOS 12, iOS 13, *)
@_backDeploy(before: iOS 12) // This is invalid but it can only be diagnosed when building for iOS @backDeployed(before: iOS 12) // This is invalid but it can only be diagnosed when building for iOS
public func availableAfterBackDeploymentForInactiveAttribute() {} public func availableAfterBackDeploymentForInactiveAttribute() {}
@available(macOS 12, *) // expected-note {{'memberFunc()' was introduced in macOS 12}} @available(macOS 12, *) // expected-note {{'memberFunc()' was introduced in macOS 12}}
public struct AvailableMacOS12Struct { public struct AvailableMacOS12Struct {
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'memberFunc()' is not available before macOS 12}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'memberFunc()' is not available before macOS 12}}
public func memberFunc() {} public func memberFunc() {}
} }
@available(macOS 12, *) // expected-note {{'methodInExtensionAvailableMacOS12()' was introduced in macOS 12}} @available(macOS 12, *) // expected-note {{'methodInExtensionAvailableMacOS12()' was introduced in macOS 12}}
extension TopLevelStruct { extension TopLevelStruct {
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'methodInExtensionAvailableMacOS12()' is not available before macOS 12}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'methodInExtensionAvailableMacOS12()' is not available before macOS 12}}
public func methodInExtensionAvailableMacOS12() {} public func methodInExtensionAvailableMacOS12() {}
} }
extension TopLevelStruct { extension TopLevelStruct {
@available(macOS 12, *) // expected-note {{getter for 'propertyAvailableMacOS12' was introduced in macOS 12}} @available(macOS 12, *) // expected-note {{getter for 'propertyAvailableMacOS12' was introduced in macOS 12}}
public var propertyAvailableMacOS12: Int { public var propertyAvailableMacOS12: Int {
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because getter for 'propertyAvailableMacOS12' is not available before macOS 12}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because getter for 'propertyAvailableMacOS12' is not available before macOS 12}}
get { 0 } get { 0 }
} }
} }
@available(macOS, unavailable) // expected-note {{'unavailableMacOSFunc()' has been explicitly marked unavailable here}} @available(macOS, unavailable) // expected-note {{'unavailableMacOSFunc()' has been explicitly marked unavailable here}}
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'unavailableMacOSFunc()' is unavailable on macOS}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'unavailableMacOSFunc()' is unavailable on macOS}}
public func unavailableMacOSFunc() {} public func unavailableMacOSFunc() {}
@available(macOS, unavailable) @available(macOS, unavailable)
@available(iOS, unavailable) @available(iOS, unavailable)
@_backDeploy(before: iOS 12) // This is invalid but it can only be diagnosed when building for iOS @backDeployed(before: iOS 12) // This is invalid but it can only be diagnosed when building for iOS
public func unavailableForInactiveAttributeFunc() {} public func unavailableForInactiveAttributeFunc() {}
@available(*, unavailable) // expected-note {{'alwaysUnavailableFunc()' has been explicitly marked unavailable here}} @available(*, unavailable) // expected-note {{'alwaysUnavailableFunc()' has been explicitly marked unavailable here}}
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'alwaysUnavailableFunc()' is unavailable on macOS}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'alwaysUnavailableFunc()' is unavailable on macOS}}
public func alwaysUnavailableFunc() {} public func alwaysUnavailableFunc() {}
@available(macOS, unavailable) // expected-note {{'memberFunc()' has been explicitly marked unavailable here}} @available(macOS, unavailable) // expected-note {{'memberFunc()' has been explicitly marked unavailable here}}
public struct UnavailableMacOSStruct { public struct UnavailableMacOSStruct {
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'memberFunc()' is unavailable on macOS}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'memberFunc()' is unavailable on macOS}}
public func memberFunc() {} public func memberFunc() {}
} }
@available(macOS, unavailable) // expected-note {{'methodInUnavailableExtension()' has been explicitly marked unavailable here}} @available(macOS, unavailable) // expected-note {{'methodInUnavailableExtension()' has been explicitly marked unavailable here}}
extension TopLevelStruct { extension TopLevelStruct {
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because 'methodInUnavailableExtension()' is unavailable on macOS}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because 'methodInUnavailableExtension()' is unavailable on macOS}}
public func methodInUnavailableExtension() {} public func methodInUnavailableExtension() {}
} }
extension TopLevelStruct { extension TopLevelStruct {
@available(macOS, unavailable) // expected-note {{getter for 'unavailableMacOSProperty' has been explicitly marked unavailable here}} @available(macOS, unavailable) // expected-note {{getter for 'unavailableMacOSProperty' has been explicitly marked unavailable here}}
public var unavailableMacOSProperty: Int { public var unavailableMacOSProperty: Int {
@_backDeploy(before: macOS 12) // expected-error {{'@_backDeploy' has no effect because getter for 'unavailableMacOSProperty' is unavailable on macOS}} @backDeployed(before: macOS 12) // expected-error {{'@backDeployed' has no effect because getter for 'unavailableMacOSProperty' is unavailable on macOS}}
get { 0 } get { 0 }
} }
} }

View File

@@ -1,6 +1,6 @@
// //
// At a high level, this test is designed to verify that use of declarations // At a high level, this test is designed to verify that use of declarations
// annotated with @_backDeploy behave as expected when running a client binary // annotated with @backDeployed behave as expected when running a client binary
// on an older OS that does not have the back deployed APIs. The // on an older OS that does not have the back deployed APIs. The
// BackDeployHelper framework has a number of APIs that are available in the // BackDeployHelper framework has a number of APIs that are available in the
// OSes identified by the "BackDeploy 1.0" availability macro and are back // OSes identified by the "BackDeploy 1.0" availability macro and are back

View File

@@ -615,12 +615,12 @@ public func spiDeployedUseNoAvailable( // expected-note 3 {{add @available attri
} }
// MARK: - @_backDeploy functions // MARK: - @backDeployed functions
// @_backDeploy acts like @inlinable. // @backDeployed acts like @inlinable.
@available(macOS 10.10, *) @available(macOS 10.10, *)
@_backDeploy(before: macOS 999.0) @backDeployed(before: macOS 999.0)
public func backDeployedToInliningTarget( public func backDeployedToInliningTarget(
_: NoAvailable, _: NoAvailable,
_: BeforeInliningTarget, _: BeforeInliningTarget,

View File

@@ -2668,10 +2668,10 @@ class issue55246 {
// access-note-adjust{{@objc}} expected-error@-1 {{subscript cannot be marked @objc because it has generic parameters}} // access-note-adjust{{@objc}} expected-error@-1 {{subscript cannot be marked @objc because it has generic parameters}}
} }
// @_backDeploy // @backDeployed
public class BackDeployClass { public class BackDeployClass {
@_backDeploy(before: macOS 12.0) // expected-error {{'@_backDeploy' must not be used on an '@objc' instance method}} @backDeployed(before: macOS 12.0) // expected-error {{'@backDeployed' must not be used on an '@objc' instance method}}
@objc @objc
final public func objcMethod() {} final public func objcMethod() {}
} }