Skip to content

Commit 574d302

Browse files
authored
Merge pull request #25288 from hamishknight/selfish-operators-5.1
2 parents 9729868 + d29ec92 commit 574d302

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ bool constraints::areConservativelyCompatibleArgumentLabels(
131131
bool hasCurriedSelf;
132132
if (isa<SubscriptDecl>(decl)) {
133133
hasCurriedSelf = false;
134+
} else if (decl->isStatic() && isa<AbstractFunctionDecl>(decl)) {
135+
// Static methods always have their Self.Type parameter applied.
136+
hasCurriedSelf = true;
134137
} else if (!baseType || baseType->is<ModuleType>()) {
135138
hasCurriedSelf = false;
136139
} else if (baseType->is<AnyMetatypeType>() && decl->isInstanceMember()) {

test/Constraints/operator.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,17 @@ func rdar46459603() {
223223
_ = [arr.values] == [[e]]
224224
// expected-error@-1 {{protocol type 'Any' cannot conform to 'Equatable' because only concrete types can conform to protocols}}
225225
}
226+
227+
// SR-10843
228+
infix operator ^^^
229+
func ^^^ (lhs: String, rhs: String) {}
230+
231+
struct SR10843 {
232+
static func ^^^ (lhs: SR10843, rhs: SR10843) {}
233+
}
234+
235+
func sr10843() {
236+
let s = SR10843()
237+
(^^^)(s, s)
238+
_ = (==)(0, 0)
239+
}

0 commit comments

Comments
 (0)