-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy pathavailability-real-sdk.swift
154 lines (138 loc) · 9.46 KB
/
availability-real-sdk.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -o %t %s
// RUN: %target-swift-frontend -parse-as-library %t/availability-real-sdk.swiftmodule -typecheck -verify -emit-objc-header-path %t/availability-real-sdk.h -import-objc-header %S/../Inputs/empty.h
// RUN: %FileCheck %s < %t/availability-real-sdk.h
// RUN: %check-in-clang %t/availability-real-sdk.h
// REQUIRES: objc_interop
// CHECK-LABEL: @interface NSArray<ObjectType> (SWIFT_EXTENSION(main))
// CHECK-NEXT: - (id _Nonnull)deprecatedMethodInFavorOfReverseObjectEnumerator SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This method is deprecated in favor to the old reverseObjectEnumerator method", "reverseObjectEnumerator");
// CHECK-NEXT: - (id _Nonnull)deprecatedMethodOnMacOSInFavorOfReverseObjectEnumerator SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_AVAILABILITY(macos,deprecated=0.0.1,message="'deprecatedMethodOnMacOSInFavorOfReverseObjectEnumerator' has been renamed to 'reverseObjectEnumerator': This method is deprecated in favor to the old reverseObjectEnumerator method");
// CHECK-NEXT: - (id _Nonnull)unavailableMethodInFavorOfReverseObjectEnumerator SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_UNAVAILABLE_MSG("'unavailableMethodInFavorOfReverseObjectEnumerator' has been renamed to 'reverseObjectEnumerator': This method is unavailable in favor to the old reverseObjectEnumerator method");
// CHECK-NEXT: - (id _Nonnull)unavailableMethodOnMacOSInFavorOfReverseObjectEnumerator SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_AVAILABILITY(macos,unavailable,message="'unavailableMethodOnMacOSInFavorOfReverseObjectEnumerator' has been renamed to 'reverseObjectEnumerator': This method is unavailable in favor to the old reverseObjectEnumerator method");
// CHECK-NEXT: - (NSArray * _Nonnull)deprecatedMethodInFavorOfAddingObjectWithObject:(id _Nonnull)object SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This method is deprecated in favor to the old adding method", "arrayByAddingObject:");
// CHECK-NEXT: - (NSArray * _Nonnull)deprecatedMethodOnMacOSInFavorOfAddingObjectWithObject:(id _Nonnull)object SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_AVAILABILITY(macos,deprecated=0.0.1,message="'deprecatedMethodOnMacOSInFavorOfAddingObject' has been renamed to 'arrayByAddingObject:': This method is deprecated in favor to the old adding method");
// CHECK-NEXT: - (NSArray * _Nonnull)unavailableMethodInFavorOfAddingObjectWithObject:(id _Nonnull)object SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_UNAVAILABLE_MSG("'unavailableMethodInFavorOfAddingObject' has been renamed to 'arrayByAddingObject:': This method is unavailable in favor to the old adding method");
// CHECK-NEXT: - (NSArray * _Nonnull)unavailableMethodOnMacOSInFavorOfAddingObjectWithObject:(id _Nonnull)object SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_AVAILABILITY(macos,unavailable,message="'unavailableMethodOnMacOSInFavorOfAddingObject' has been renamed to 'arrayByAddingObject:': This method is unavailable in favor to the old adding method");
// CHECK-NEXT: @end
// CHECK-LABEL: @interface SubClassOfSet : NSSet
// CHECK-NEXT: - (id _Nonnull)deprecatedMethodInFavorOfAnyObject SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This method is deprecated in favor to the old anyObject method", "anyObject");
// CHECK-NEXT: - (id _Nonnull)deprecatedMethodOnMacOSInFavorOfAnyObject SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_AVAILABILITY(macos,deprecated=0.0.1,message="'deprecatedMethodOnMacOSInFavorOfAnyObject' has been renamed to 'anyObject': This method is deprecated in favor to the old anyObject method");
// CHECK-NEXT: - (id _Nonnull)unavailableMethodInFavorOfAnyObject SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_UNAVAILABLE_MSG("'unavailableMethodInFavorOfAnyObject' has been renamed to 'anyObject': This method is unavailable in favor to the old anyObject method");
// CHECK-NEXT: - (id _Nonnull)unavailableMethodOnMacOSInFavorOfAnyObject SWIFT_WARN_UNUSED_RESULT
// CHECK-SAME: SWIFT_AVAILABILITY(macos,unavailable,message="'unavailableMethodOnMacOSInFavorOfAnyObject' has been renamed to 'anyObject': This method is unavailable in favor to the old anyObject method");
// CHECK-NEXT: @property (nonatomic, readonly) NSInteger deprecatedPropertyInFavorOfCount
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This property is deprecated in favor to the old count property", "count");
// CHECK-NEXT: @property (nonatomic, readonly) NSInteger deprecatedOnMacOSPropertyInFavorOfCount
// CHECK-SAME: SWIFT_AVAILABILITY(macos,deprecated=0.0.1,message="'deprecatedOnMacOSPropertyInFavorOfCount' has been renamed to 'count': This property is deprecated in favor to the old count property");
// CHECK-NEXT: @property (nonatomic, readonly) NSInteger unavailablePropertyInFavorOfCount
// CHECK-SAME: SWIFT_UNAVAILABLE_MSG("'unavailablePropertyInFavorOfCount' has been renamed to 'count': This property is unavailable in favor to the old count property");
// CHECK-NEXT: @property (nonatomic, readonly) NSInteger unavailableOnMacOSPropertyInFavorOfCount
// CHECK-SAME: SWIFT_AVAILABILITY(macos,unavailable,message="'unavailableOnMacOSPropertyInFavorOfCount' has been renamed to 'count': This property is unavailable in favor to the old count property");
// CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
// CHECK-NEXT: - (nonnull instancetype)initWithObjects:(id _Nonnull const * _Nullable)objects count:(NSUInteger)cnt OBJC_DESIGNATED_INITIALIZER;
// CHECK-NEXT: - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull){{[a-zA-Z]+}} OBJC_DESIGNATED_INITIALIZER;
// CHECK-NEXT: @end
import Foundation
public class SubClassOfSet: NSSet {
@available(*, deprecated,
message: "This method is deprecated in favor to the old anyObject method",
renamed: "anyObject()")
@objc func deprecatedMethodInFavorOfAnyObject() -> Any { return 0 }
@available(macOS, deprecated,
message: "This method is deprecated in favor to the old anyObject method",
renamed: "anyObject()")
@objc func deprecatedMethodOnMacOSInFavorOfAnyObject() -> Any { return 0 }
@available(*, unavailable,
message: "This method is unavailable in favor to the old anyObject method",
renamed: "anyObject()")
@objc func unavailableMethodInFavorOfAnyObject() -> Any { return 0 }
@available(macOS, unavailable,
message: "This method is unavailable in favor to the old anyObject method",
renamed: "anyObject()")
@objc func unavailableMethodOnMacOSInFavorOfAnyObject() -> Any { return 0 }
@available(*, deprecated,
message: "This property is deprecated in favor to the old count property",
renamed: "count")
@objc var deprecatedPropertyInFavorOfCount: Int {
get {
return 0
}
}
@available(macOS, deprecated,
message: "This property is deprecated in favor to the old count property",
renamed: "count")
@objc var deprecatedOnMacOSPropertyInFavorOfCount: Int {
get {
return 0
}
}
@available(*, unavailable,
message: "This property is unavailable in favor to the old count property",
renamed: "count")
@objc var unavailablePropertyInFavorOfCount: Int {
get {
return 0
}
}
@available(macOS, unavailable,
message: "This property is unavailable in favor to the old count property",
renamed: "count")
@objc var unavailableOnMacOSPropertyInFavorOfCount: Int {
get {
return 0
}
}
}
extension NSArray {
@available(*, deprecated,
message: "This method is deprecated in favor to the old reverseObjectEnumerator method",
renamed: "reverseObjectEnumerator()")
@objc func deprecatedMethodInFavorOfReverseObjectEnumerator() -> Any { return 0 }
@available(macOS, deprecated,
message: "This method is deprecated in favor to the old reverseObjectEnumerator method",
renamed: "reverseObjectEnumerator()")
@objc func deprecatedMethodOnMacOSInFavorOfReverseObjectEnumerator() -> Any { return 0 }
@available(*, unavailable,
message: "This method is unavailable in favor to the old reverseObjectEnumerator method",
renamed: "reverseObjectEnumerator()")
@objc func unavailableMethodInFavorOfReverseObjectEnumerator() -> Any { return 0 }
@available(macOS, unavailable,
message: "This method is unavailable in favor to the old reverseObjectEnumerator method",
renamed: "reverseObjectEnumerator()")
@objc func unavailableMethodOnMacOSInFavorOfReverseObjectEnumerator() -> Any { return 0 }
@available(*, deprecated,
message: "This method is deprecated in favor to the old adding method",
renamed: "adding(_:)")
@objc func deprecatedMethodInFavorOfAddingObject(object: Any) -> NSArray {
return self.adding(object) as NSArray
}
@available(macOS, deprecated,
message: "This method is deprecated in favor to the old adding method",
renamed: "adding(_:)")
@objc func deprecatedMethodOnMacOSInFavorOfAddingObject(object: Any) -> NSArray {
return self.adding(object) as NSArray
}
@available(*, unavailable,
message: "This method is unavailable in favor to the old adding method",
renamed: "adding(_:)")
@objc func unavailableMethodInFavorOfAddingObject(object: Any) -> NSArray {
return self.adding(object) as NSArray
}
@available(macOS, unavailable,
message: "This method is unavailable in favor to the old adding method",
renamed: "adding(_:)")
@objc func unavailableMethodOnMacOSInFavorOfAddingObject(object: Any) -> NSArray {
return self.adding(object) as NSArray
}
}