mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] += no longer appends array elements
+= only extends arrays with another sequence of the same element type. Fixes <rdar://problem/17151420> The use of the overloaded += operator in Swift is inconsistent and confusing with Arrays. Note that this commits generated 3 new radars against the type checker: <rdar://problem/17751308> <rdar://problem/17750582> <rdar://problem/17751359> Swift SVN r20274
This commit is contained in:
@@ -52,7 +52,7 @@ public struct SourceLocStack {
|
||||
|
||||
func with(loc: SourceLoc) -> SourceLocStack {
|
||||
var locs = self.locs
|
||||
locs += loc
|
||||
locs.append(loc)
|
||||
return SourceLocStack(_locs: locs)
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ func checkGenerator<
|
||||
var mutableGen = generator
|
||||
var actual: [Element] = []
|
||||
while let e = mutableGen.next() {
|
||||
actual += e
|
||||
actual.append(e)
|
||||
}
|
||||
expectEqual(expected, actual, stackTrace: stackTrace.withCurrentLoc())
|
||||
|
||||
@@ -398,7 +398,7 @@ func checkCollection<
|
||||
expectEqual(startIndex, collection.startIndex)
|
||||
expectEqual(endIndex, collection.endIndex)
|
||||
|
||||
actual += collection[index]
|
||||
actual.append(collection[index])
|
||||
++index
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user