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: Sendable[#Func Attribute#]; name=Sendable
// KEYWORD2-NEXT: Keyword/None: preconcurrency[#Func Attribute#]; name=preconcurrency
// KEYWORD2-NEXT: Keyword/None: backDeployed[#Func Attribute#]; name=backDeployed
// KEYWORD2-NOT: Keyword
// KEYWORD2-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// 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: noDerivative[#Func Attribute#]; name=noDerivative
// 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-DAG: Decl[Struct]/CurrModule: MyStruct[#MyStruct#]; name=MyStruct
// ON_METHOD-DAG: Decl[Struct]/CurrModule: MyPropertyWrapper[#MyPropertyWrapper#]; name=MyPropertyWrapper

View File

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

View File

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

View File

@@ -6,13 +6,13 @@
// REQUIRES: OS=macosx
@_backDeploy(before: macOS 10.52)
@backDeployed(before: macOS 10.52)
public func someFunc() {}
public struct S<T> {
@usableFromInline var _x: T
@_backDeploy(before: macOS 10.52)
@backDeployed(before: macOS 10.52)
public var x: T {
get { _x }
set { _x = newValue }
@@ -59,7 +59,7 @@ func aeicCaller(_ s: inout S<Z>) {
}
// 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>) {
// CHECK: function_ref @$s11back_deploy8someFuncyyFTwb : $@convention(thin) () -> ()
someFunc()

View File

@@ -35,7 +35,7 @@ public struct TopLevelStruct {
// -- Original definition of TopLevelStruct.property.getter
// 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 }
}

View File

@@ -62,7 +62,7 @@ public struct TopLevelStruct {
// -- Original definition of TopLevelStruct.property.read
// 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 {
_read { yield self }
}

View File

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

View File

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

View File

@@ -37,7 +37,7 @@
// -- Original definition of genericFunc(_:)
// 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 {
return t
}
@@ -76,7 +76,7 @@ public func genericFunc<T>(_ t: T) -> T {
// -- Original definition of genericFuncWithOwnedParam(_:)
// 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) { }
struct S {}

View File

@@ -56,7 +56,7 @@ public struct TopLevelStruct<T> {
// -- 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>
@available(macOS 10.51, *)
@_backDeploy(before: macOS 10.52)
@backDeployed(before: macOS 10.52)
public init(_ t: T) {
self.t = t
}

View File

@@ -37,7 +37,7 @@ public struct TopLevelStruct {
// -- Original definition of TopLevelStruct.trivialMethod()
// 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() {}
}

View File

@@ -49,7 +49,7 @@
// -- Original definition of throwingFunc()
// 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 {}
// 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-LABEL: } // end sil function '$s20opaque_values_silgen29backDeployingReturningGenericyxxKlFTwb'
@available(SwiftStdlib 5.1, *)
@_backDeploy(before: SwiftStdlib 5.8)
@backDeployed(before: SwiftStdlib 5.8)
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() {
if #available(_iOS9Aligned, *) { } // 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 '@_backDeploy' function}}
if #available(iOS 9.0, _macOS10_11, tvOS 9.0, *) { } // expected-error {{availability macro cannot be used in a '@_backDeploy' function}}
if #unavailable(_iOS9Aligned) { } // 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 '@_backDeploy' function}}
if #unavailable(iOS 9.0, _macOS10_11, tvOS 9.0) { } // 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 '@backDeployed' 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 '@backDeployed' 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 '@backDeployed' function}}
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
@_backDeploy(before: SwiftStdlib 5.7)
@backDeployed(before: SwiftStdlib 5.7)
public func foo() {}

View File

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

View File

@@ -4,45 +4,45 @@
// MARK: - Valid declarations
// Ok, top level functions
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedTopLevelFunc() {}
// Ok, internal decls may be back deployed when @usableFromInline
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
@usableFromInline
internal func backDeployedUsableFromInlineTopLevelFunc() {}
// Ok, decls in a struct
public struct TopLevelStruct {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public init<T>(_ t: T) {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedMethod() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public var backDeployedComputedProperty: Int { 98 }
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public subscript(_ index: Int) -> Int { index }
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public var readWriteProperty: Int {
get { 42 }
set(newValue) {}
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public subscript(at index: Int) -> Int {
get { 42 }
set(newValue) {}
}
public var explicitReadAndModify: Int {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
_read { yield 42 }
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
_modify {}
}
}
@@ -51,7 +51,7 @@ public struct TopLevelStruct {
public enum TopLevelEnum {
case a, b
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public init?(from name: String) {
switch name {
case "a": self = .a
@@ -60,10 +60,10 @@ public enum TopLevelEnum {
}
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedMethod() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public var name: String {
switch self {
case .a: return "a"
@@ -80,29 +80,29 @@ public class TopLevelClass {
self.x = x
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public convenience init() {
self.init(x: 1)
}
public func hook() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public func backDeployedFinalMethod() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public var backDeployedFinalComputedProperty: Int { 98 }
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public static func backDeployedStaticMethod() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public final class func backDeployedClassMethod() {}
}
// Ok, final decls in a non-final, derived class
public class DerivedTopLevelClass: TopLevelClass {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public func backDeployedFinalMethodOnDerived() {}
}
@@ -114,15 +114,15 @@ final public class FinalTopLevelClass {
self.x = x
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public convenience init() {
self.init(x: 1)
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedMethod() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public var backDeployedComputedProperty: Int { 98 }
}
@@ -135,15 +135,15 @@ public actor TopLevelActor {
self.x = x
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public init() {
self.init(x: 1)
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public func method() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public var computedProperty: Int { 98 }
}
@@ -156,107 +156,107 @@ final public actor FinalTopLevelActor {
self.x = x
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public init() {
self.init(x: 1)
}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func method() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public var computedProperty: Int { 98 }
}
// Ok, decls in extensions of public types
extension TopLevelStruct {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {}
}
extension TopLevelClass {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public func backDeployedExtensionMethod() {}
}
extension FinalTopLevelClass {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {}
}
@available(SwiftStdlib 5.1, *)
extension TopLevelActor {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
final public func backDeployedExtensionMethod() {}
}
@available(SwiftStdlib 5.1, *)
extension FinalTopLevelActor {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {}
}
public protocol TopLevelProtocol {}
extension TopLevelProtocol {
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
public func backDeployedExtensionMethod() {}
}
// 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 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 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 {}
}
// Ok, final decls in a non-final, derived class
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() {}
}
@available(SwiftStdlib 5.1, *)
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) {}
}
@_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 {
@_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
@_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
}
@_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 {
@_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
}
@_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
@_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 {}
@_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 {}
@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 {}
@@ -269,147 +269,152 @@ public struct FunctionBodyDiagnostics {
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}}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
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()
usableFromInlineFunc()
internalFunc() // expected-error {{instance method 'internalFunc()' is internal and cannot be referenced from a '@_backDeploy' function}}
fileprivateFunc() // expected-error {{instance method 'fileprivateFunc()' is fileprivate and cannot be referenced from a '@_backDeploy' function}}
privateFunc() // expected-error {{instance method 'privateFunc()' is private 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 '@backDeployed' function}}
privateFunc() // expected-error {{instance method 'privateFunc()' is private and cannot be referenced from a '@backDeployed' function}}
}
}
// 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() {}
@_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() {}
@_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() {}
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 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() {}
@_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() {}
}
@_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() {}
@_backDeploy(before: macOS 12.0)
@_backDeploy(before: macOS 13.0) // expected-error {{'@_backDeploy' contains multiple versions for macOS}}
@backDeployed(before: macOS 12.0)
@backDeployed(before: macOS 13.0) // expected-error {{'@backDeployed' contains multiple versions for macOS}}
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}}
public func alwaysEmitIntoClientFunc() {}
@_backDeploy(before: macOS 12.0)
@backDeployed(before: macOS 12.0)
@inlinable // Ok
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}}
public func transparentFunc() {}
// 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() {}
@_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() {}
@_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() {}
@_backDeploy(before: @) // expected-error {{expected platform in '@_backDeploy' attribute}}
@backDeployed(before: @) // expected-error {{expected platform in '@backDeployed' attribute}}
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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
@_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() {}
// Fall back to the default diagnostic when the macro is unknown.
@_backDeploy(before: _unknownMacro) // expected-warning {{unknown platform '_unknownMacro' for attribute '@_backDeploy'}}
// expected-error@-1 {{expected version number in '@_backDeploy' attribute}}
@backDeployed(before: _unknownMacro) // expected-warning {{unknown platform '_unknownMacro' for attribute '@backDeployed'}}
// expected-error@-1 {{expected version number in '@backDeployed' attribute}}
public func unknownMacroMissingVersion() {}
@_backDeploy(before: _unknownMacro 1.0) // expected-warning {{unknown platform '_unknownMacro' for attribute '@_backDeploy'}}
// expected-error@-1 {{expected at least one platform version in '@_backDeploy' attribute}}
@backDeployed(before: _unknownMacro 1.0) // expected-warning {{unknown platform '_unknownMacro' for attribute '@backDeployed'}}
// expected-error@-1 {{expected at least one platform version in '@backDeployed' attribute}}
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() {}
@_backDeploy() // expected-error {{expected 'before:' in '@_backDeploy' attribute}}
// expected-error@-1 {{expected at least one platform version in '@_backDeploy' attribute}}
@backDeployed() // expected-error {{expected 'before:' in '@backDeployed' attribute}}
// expected-error@-1 {{expected at least one platform version in '@backDeployed' attribute}}
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() {}
@_backDeploy(before) // expected-error {{expected ':' after 'before' in '@_backDeploy' attribute}} {{20-20=:}}
// expected-error@-1 {{expected at least one platform version in '@_backDeploy' attribute}}
@backDeployed(before) // expected-error {{expected ':' after 'before' in '@backDeployed' attribute}} {{21-21=:}}
// expected-error@-1 {{expected at least one platform version in '@backDeployed' attribute}}
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() {}
@_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() {}
@_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() {}
@_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() {}
@_backDeploy // expected-error {{expected '(' in '@_backDeploy' attribute}}
@backDeployed // expected-error {{expected '(' in '@backDeployed' attribute}}
public func expectedLeftParenFunc() {}
@_backDeploy(before: macOS 12.0 // expected-note {{to match this opening '('}}
public func expectedRightParenFunc() {} // expected-error {{expected ')' in '@_backDeploy' argument list}}
@backDeployed(before: macOS 12.0 // expected-note {{to match this opening '('}}
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
@_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 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() {}
}
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() {}
}
@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() {}
@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() {}
@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() {}
@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() {}
@available(macOS 12, *) // expected-note {{'memberFunc()' was introduced in macOS 12}}
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() {}
}
@available(macOS 12, *) // expected-note {{'methodInExtensionAvailableMacOS12()' was introduced in macOS 12}}
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() {}
}
extension TopLevelStruct {
@available(macOS 12, *) // expected-note {{getter for 'propertyAvailableMacOS12' was introduced in macOS 12}}
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 }
}
}
@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() {}
@available(macOS, 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() {}
@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() {}
@available(macOS, unavailable) // expected-note {{'memberFunc()' has been explicitly marked unavailable here}}
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() {}
}
@available(macOS, unavailable) // expected-note {{'methodInUnavailableExtension()' has been explicitly marked unavailable here}}
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() {}
}
extension TopLevelStruct {
@available(macOS, unavailable) // expected-note {{getter for 'unavailableMacOSProperty' has been explicitly marked unavailable here}}
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 }
}
}

View File

@@ -1,6 +1,6 @@
//
// 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
// BackDeployHelper framework has a number of APIs that are available in the
// 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, *)
@_backDeploy(before: macOS 999.0)
@backDeployed(before: macOS 999.0)
public func backDeployedToInliningTarget(
_: NoAvailable,
_: 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}}
}
// @_backDeploy
// @backDeployed
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
final public func objcMethod() {}
}