Skip to content

Commit b746e3b

Browse files
committed
Revert "Warn about async-imported selector conflicts"
This reverts commit b8422a1.
1 parent 47c6303 commit b746e3b

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,12 +2257,6 @@ namespace {
22572257
/// Produce a deterministic ordering of the given declarations.
22582258
struct OrderDeclarations {
22592259
bool operator()(ValueDecl *lhs, ValueDecl *rhs) const {
2260-
// If one declaration is imported from ObjC and the other is native Swift,
2261-
// put the imported Clang one first.
2262-
if (lhs->hasClangNode() != rhs->hasClangNode()) {
2263-
return lhs->hasClangNode();
2264-
}
2265-
22662260
// If the declarations come from different modules, order based on the
22672261
// module.
22682262
ModuleDecl *lhsModule = lhs->getDeclContext()->getParentModule();
@@ -2512,10 +2506,6 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
25122506
RULE(!isa<ExtensionDecl>(a->getDeclContext()),
25132507
!isa<ExtensionDecl>(b->getDeclContext()));
25142508

2515-
// Is one of these imported from Objective-C?
2516-
RULE(a->hasClangNode(),
2517-
b->hasClangNode());
2518-
25192509
// Are these from different source files? If so, fall back to the order in
25202510
// which the declarations were type checked.
25212511
// FIXME: This is gross and nondeterministic.
@@ -2544,28 +2534,16 @@ bool swift::diagnoseObjCMethodConflicts(SourceFile &sf) {
25442534
if (auto accessor = dyn_cast<AccessorDecl>(originalMethod))
25452535
originalDecl = accessor->getStorage();
25462536

2547-
// Conflicts between two imported ObjC methods are caused by the same
2548-
// clang decl having several Swift names.
2549-
if (originalDecl->hasClangNode() && conflictingDecl->hasClangNode())
2550-
continue;
2551-
2552-
bool breakingInSwift5 = false;
2553-
// Imported ObjC async methods weren't fully checked for selector
2554-
// conflicts until 5.7.
2555-
if (originalMethod->hasClangNode() && originalMethod->hasAsync())
2556-
breakingInSwift5 = true;
2557-
// Protocols weren't checked for selector conflicts in 5.0.
2558-
if (!isa<ClassDecl>(conflict.typeDecl))
2559-
breakingInSwift5 = true;
2560-
25612537
bool redeclSame = (diagInfo == origDiagInfo);
25622538
auto diag = Ctx.Diags.diagnose(conflictingDecl,
25632539
redeclSame ? diag::objc_redecl_same
25642540
: diag::objc_redecl,
25652541
diagInfo.first, diagInfo.second,
25662542
origDiagInfo.first, origDiagInfo.second,
25672543
conflict.selector);
2568-
diag.warnUntilSwiftVersionIf(breakingInSwift5, 6);
2544+
2545+
// Protocols weren't checked for selector conflicts in 5.0.
2546+
diag.warnUntilSwiftVersionIf(!isa<ClassDecl>(conflict.typeDecl), 6);
25692547

25702548
auto objcAttr = getObjCAttrIfFromAccessNote(conflictingDecl);
25712549
swift::softenIfAccessNote(conflictingDecl, objcAttr, diag);

test/Concurrency/Inputs/Delegate.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,4 @@
2121
-(void)myAsyncMethod:(void (^ _Nullable)(NSError * _Nullable, NSString * _Nullable))completionHandler;
2222
@end
2323

24-
@interface Delegate (SwiftImpls)
25-
26-
- (void)makeRequestFromSwift:(Request * _Nonnull)request completionHandler:(void (^ _Nullable)(void))handler;
27-
28-
@end
29-
3024
#endif

test/Concurrency/objc_async_overload.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,3 @@ extension Delegate {
5353
}
5454
}
5555
}
56-
57-
// rdar://95887113 - Implementing an ObjC category method in Swift is not strictly valid, but should be tolerated
58-
59-
extension Delegate {
60-
@objc public func makeRequest(fromSwift: Request, completionHandler: (() -> Void)?) {}
61-
// expected-warning@-1 {{method 'makeRequest(fromSwift:completionHandler:)' with Objective-C selector 'makeRequestFromSwift:completionHandler:' conflicts with method 'makeRequest(fromSwift:)' with the same Objective-C selector; this is an error in Swift 6}}
62-
}

0 commit comments

Comments
 (0)