Skip to content

Commit b3a0a5e

Browse files
committed
Add the deprecation messages in the renamed-to Objective-C name test cases
1 parent 65dc151 commit b3a0a5e

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

test/PrintAsObjC/availability-real-sdk.swift

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99

1010
// CHECK-LABEL: @interface NSArray<ObjectType> (SWIFT_EXTENSION(main))
1111
// CHECK-NEXT: - (id _Nonnull)methodDeprecatedInFavorOfReverseObjectEnumerator SWIFT_WARN_UNUSED_RESULT
12-
// CHECK-SAME: SWIFT_DEPRECATED_MSG("", "reverseObjectEnumerator");
12+
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This method is deprecated in favor to the old reverseObjectEnumerator method", "reverseObjectEnumerator");
1313
// CHECK-NEXT: - (NSArray * _Nonnull)methodDeprecatedInFavorOfAddingObjectWithObject:(id _Nonnull)object SWIFT_WARN_UNUSED_RESULT
14-
// CHECK-SAME: SWIFT_DEPRECATED_MSG("", "arrayByAddingObject:");
14+
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This method is deprecated in favor to the old adding method", "arrayByAddingObject:");
1515

1616
// CHECK-NEXT: @end
1717

1818
// CHECK-LABEL: @interface SubClassOfSet : NSSet
1919
// CHECK-NEXT: - (id _Nonnull)methodDeprecatedInFavorOfAnyObject SWIFT_WARN_UNUSED_RESULT
20-
// CHECK-SAME: SWIFT_DEPRECATED_MSG("", "anyObject");
20+
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This method is deprecated in favor to the old anyObject method", "anyObject");
21+
// CHECK-NEXT: @property (nonatomic, readonly) NSInteger deprecatedPropertyInFavorOfCount
22+
// CHECK-SAME: SWIFT_DEPRECATED_MSG("This property is deprecated in favor to the old count property", "count");
2123
// CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
2224
// CHECK-NEXT: - (nonnull instancetype)initWithObjects:(id _Nonnull const * _Nullable)objects count:(NSUInteger)cnt OBJC_DESIGNATED_INITIALIZER;
2325
// CHECK-NEXT: - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
@@ -28,16 +30,31 @@ import Foundation
2830

2931

3032
public class SubClassOfSet: NSSet {
31-
@available(*, deprecated, renamed: "anyObject()")
33+
@available(*, deprecated,
34+
message: "This method is deprecated in favor to the old anyObject method",
35+
renamed: "anyObject()")
3236
@objc func methodDeprecatedInFavorOfAnyObject() -> Any { return 0 }
37+
38+
@available(*, deprecated,
39+
message: "This property is deprecated in favor to the old count property",
40+
renamed: "count")
41+
@objc var deprecatedPropertyInFavorOfCount: Int {
42+
get {
43+
return 0
44+
}
45+
}
3346
}
3447

3548

3649
extension NSArray {
37-
@available(*, deprecated, renamed: "reverseObjectEnumerator()")
50+
@available(*, deprecated,
51+
message: "This method is deprecated in favor to the old reverseObjectEnumerator method",
52+
renamed: "reverseObjectEnumerator()")
3853
@objc func methodDeprecatedInFavorOfReverseObjectEnumerator() -> Any { return 0 }
3954

40-
@available(*, deprecated, renamed: "adding(_:)")
55+
@available(*, deprecated,
56+
message: "This method is deprecated in favor to the old adding method",
57+
renamed: "adding(_:)")
4158
@objc func methodDeprecatedInFavorOfAddingObject(object: Any) -> NSArray {
4259
return self.adding(object) as NSArray
4360
}

0 commit comments

Comments
 (0)