Skip to content

Commit 5663051

Browse files
authored
Merge pull request #85656 from slavapestov/fix-rdar164519548
Sema: Fix infinite loop in OrderDeclarations::operator()
2 parents 639d331 + 140bfd6 commit 5663051

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,6 +2542,9 @@ namespace {
25422542
auto opposite = (*this)(rightDecl, leftDecl);
25432543
if (normal != opposite)
25442544
return normal;
2545+
2546+
leftContext = leftContext->getParent();
2547+
rightContext = rightContext->getParent();
25452548
}
25462549

25472550
// Final tiebreaker: Kind
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Foundation
2+
3+
extension EmitTest {
4+
@objc static func emit(_ number : Int) -> Int {
5+
// expected-note@-1 {{'emit' previously declared here}}
6+
return 0
7+
}
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-typecheck-verify-swift %S/Inputs/objc_selector_conflict_multifile_other.swift
2+
// REQUIRES: objc_interop
3+
4+
import Foundation
5+
6+
class EmitTest {}
7+
8+
extension EmitTest {
9+
@objc static func emit(_ string : String) -> String {
10+
// expected-error@-1 {{method 'emit' with Objective-C selector 'emit:' conflicts with previous declaration with the same Objective-C selector}}
11+
return ""
12+
}
13+
}

0 commit comments

Comments
 (0)