Skip to content

Commit 5bdd952

Browse files
committed
Tests: More test coverage in objc_async_conformance.swift
Add regression tests for rdar://125945942.
1 parent 8a27b68 commit 5bdd952

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/ClangImporter/objc_async_conformance.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,14 @@ class ImplementsDictionaryLoader3: DictionaryLoader {
135135
class ImplementsDictionaryLoader4: DictionaryLoader {
136136
func loadDictionary(completionHandler: @escaping ([String: Int]?) -> Void) {} // expected-note {{candidate has non-matching type '(@escaping ([String : Int]?) -> Void) -> ()'}}
137137
}
138+
139+
class ImplementsFloatLoader: FloatLoader {
140+
public func loadFloat(completionHandler: @escaping (Float) -> Void) {}
141+
}
142+
143+
class ImplementsFloatLoader2: FloatLoader {
144+
public func loadFloat(withCompletionHandler completionHandler: @escaping (Float) -> Void) {}
145+
// expected-warning@-1 {{instance method 'loadFloat(withCompletionHandler:)' nearly matches optional requirement 'loadFloat(completionHandler:)' of protocol 'FloatLoader'}}
146+
// expected-note@-2 {{rename to 'loadFloat(completionHandler:)' to satisfy this requirement}}
147+
// expected-note@-3 {{move 'loadFloat(withCompletionHandler:)' to an extension to silence this warning}}
148+
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,9 @@ MAIN_ACTOR
359359
- (void)loadDictionaryWithCompletionHandler:(void (^)(NSDictionary <NSString *, NSNumber *> * _Nullable))completionHandler;
360360
@end
361361

362+
@protocol FloatLoader
363+
@optional
364+
- (void)loadFloatWithCompletionHandler:(void (^)(float))completionHandler;
365+
@end
366+
362367
#pragma clang assume_nonnull end

0 commit comments

Comments
 (0)