Skip to content

Commit 8a27b68

Browse files
committed
Tests: Increase test coverage in objc_async_conformance.swift.
Add regression tests for rdar://125935350.
1 parent 7d4f62f commit 8a27b68

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

test/ClangImporter/objc_async_conformance.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,22 @@ class C6: C5, ServiceProvider {
116116
extension ImplementsLoadable: @retroactive Loadable {
117117
public func loadStuff(withOtherIdentifier otherIdentifier: Int, reply: @escaping () -> Void) {}
118118
}
119+
120+
class ImplementsDictionaryLoader1: DictionaryLoader {
121+
func loadDictionary(completionHandler: @escaping ([String: NSNumber]?) -> Void) {}
122+
}
123+
124+
// expected-error@+1 {{type 'ImplementsDictionaryLoader2' does not conform to protocol 'DictionaryLoader'}}
125+
class ImplementsDictionaryLoader2: DictionaryLoader {
126+
func loadDictionary(completionHandler: @escaping ([String: Any]?) -> Void) {} // expected-note {{candidate has non-matching type '(@escaping ([String : Any]?) -> Void) -> ()'}}
127+
}
128+
129+
// expected-error@+1 {{type 'ImplementsDictionaryLoader3' does not conform to protocol 'DictionaryLoader'}}
130+
class ImplementsDictionaryLoader3: DictionaryLoader {
131+
func loadDictionary(completionHandler: @escaping ([String: NSNumber?]?) -> Void) {} // expected-note {{candidate has non-matching type '(@escaping ([String : NSNumber?]?) -> Void) -> ()'}}
132+
}
133+
134+
// expected-error@+1 {{type 'ImplementsDictionaryLoader4' does not conform to protocol 'DictionaryLoader'}}
135+
class ImplementsDictionaryLoader4: DictionaryLoader {
136+
func loadDictionary(completionHandler: @escaping ([String: Int]?) -> Void) {} // expected-note {{candidate has non-matching type '(@escaping ([String : Int]?) -> Void) -> ()'}}
137+
}

test/Inputs/clang-importer-sdk/usr/include/ObjCConcurrency.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,8 @@ MAIN_ACTOR
355355
- (void)loadStuffWithGroupID:(NSInteger)groupID reply:(void (^)())reply;
356356
@end
357357

358+
@protocol DictionaryLoader
359+
- (void)loadDictionaryWithCompletionHandler:(void (^)(NSDictionary <NSString *, NSNumber *> * _Nullable))completionHandler;
360+
@end
361+
358362
#pragma clang assume_nonnull end

0 commit comments

Comments
 (0)