mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Fix infinite loop in OrderDeclarations::operator()
If the two declarations were in different source files, we would get stuck in the while loop at the end. Fixes rdar://164519548.
This commit is contained in:
@@ -2542,6 +2542,9 @@ namespace {
|
||||
auto opposite = (*this)(rightDecl, leftDecl);
|
||||
if (normal != opposite)
|
||||
return normal;
|
||||
|
||||
leftContext = leftContext->getParent();
|
||||
rightContext = rightContext->getParent();
|
||||
}
|
||||
|
||||
// Final tiebreaker: Kind
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import Foundation
|
||||
|
||||
extension EmitTest {
|
||||
@objc static func emit(_ number : Int) -> Int {
|
||||
// expected-note@-1 {{'emit' previously declared here}}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
13
test/multifile/objc_selector_conflict_multifile.swift
Normal file
13
test/multifile/objc_selector_conflict_multifile.swift
Normal file
@@ -0,0 +1,13 @@
|
||||
// RUN: %target-typecheck-verify-swift %S/Inputs/objc_selector_conflict_multifile_other.swift
|
||||
// REQUIRES: objc_interop
|
||||
|
||||
import Foundation
|
||||
|
||||
class EmitTest {}
|
||||
|
||||
extension EmitTest {
|
||||
@objc static func emit(_ string : String) -> String {
|
||||
// expected-error@-1 {{method 'emit' with Objective-C selector 'emit:' conflicts with previous declaration with the same Objective-C selector}}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user