Merge pull request #83689 from tshortli/rdar-158172056-test-case

Tests: Add a test for rdar://158172056
This commit is contained in:
Allan Shortlidge
2025-08-13 13:39:31 -07:00
committed by GitHub
2 changed files with 23 additions and 0 deletions

View File

@@ -1243,3 +1243,11 @@ void takeNullableId(_Nullable id);
@interface PaletteDescriptor : NSObject <NSCopying>
@property (readonly, nonnull) ColorArray *colors;
@end
@protocol NSIndexable <NSObject>
- (id)objectAtIndex:(NSInteger)index;
@end
@interface NSCouldConformToIndexable : NSObject
- (id)objectAtIndex:(NSInteger)index;
@end

View File

@@ -0,0 +1,15 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s
// REQUIRES: objc_interop
import Foundation
extension NSCouldConformToIndexable: @retroactive NSIndexable {
}
extension NSCouldConformToIndexable {
func testIndex(_ i: Int) {
_ = objectAtIndex(i) // expected-error {{'objectAtIndex' has been renamed to 'object(at:)'}}
_ = object(at: i)
}
}