Skip to content

Commit ebc3e77

Browse files
committed
Merge pull request #2294 from apple/stdlib-simplify-plus-eq-signature
2 parents 10126f3 + 574c765 commit ebc3e77

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

stdlib/public/core/Arrays.swift.gyb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,10 +1014,8 @@ extension ${Self} {
10141014
// a `+=` operator on `RangeReplaceableCollection`.
10151015
/// Append the contents of `rhs` to `lhs`.
10161016
public func += <
1017-
Element, S : Sequence
1018-
where
1019-
S.Iterator.Element == Element
1020-
>(lhs: inout ${Self}<Element>, rhs: S) {
1017+
S : Sequence
1018+
>(lhs: inout ${Self}<S.Iterator.Element>, rhs: S) {
10211019
let oldCount = lhs.count
10221020
let capacity = lhs.capacity
10231021
let newCount = oldCount + rhs.underestimatedCount
@@ -1033,10 +1031,8 @@ public func += <
10331031
// a `+=` operator on `RangeReplaceableCollection`.
10341032
/// Append the contents of `rhs` to `lhs`.
10351033
public func += <
1036-
Element, C : Collection
1037-
where
1038-
C.Iterator.Element == Element
1039-
>(lhs: inout ${Self}<Element>, rhs: C) {
1034+
C : Collection
1035+
>(lhs: inout ${Self}<C.Iterator.Element>, rhs: C) {
10401036
let rhsCount = numericCast(rhs.count) as Int
10411037

10421038
let oldCount = lhs.count

test/Misc/misc_diagnostics.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,11 @@ func test17875634() {
9999
var col = 2
100100
var coord = (row, col)
101101

102-
match += (1, 2) // expected-error{{binary operator '+=' cannot be applied to operands of type '[(Int, Int)]' and '(Int, Int)'}}
103-
// expected-note @-1 {{overloads for '+=' exist with these partially matching parameter lists:}}
104-
105-
match += (row, col) // expected-error{{binary operator '+=' cannot be applied to operands of type '[(Int, Int)]' and '(Int, Int)'}}
106-
// expected-note @-1 {{overloads for '+=' exist with these partially matching parameter lists:}}
107-
108-
match += coord // expected-error{{binary operator '+=' cannot be applied to operands of type '[(Int, Int)]' and '(Int, Int)'}}
109-
// expected-note @-1 {{overloads for '+=' exist with these partially matching parameter lists:}}
102+
match += (1, 2) // expected-error{{argument type '(Int, Int)' does not conform to expected type 'Sequence'}}
103+
104+
match += (row, col) // expected-error{{argument type '(@lvalue Int, @lvalue Int)' does not conform to expected type 'Sequence'}}
105+
106+
match += coord // expected-error{{argument type '@lvalue (Int, Int)' does not conform to expected type 'Sequence'}}
110107

111108
match.append(row, col) // expected-error{{extra argument in call}}
112109

0 commit comments

Comments
 (0)