[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:
Dave Abrahams
2014-07-21 20:07:13 +00:00
parent 38e097c4f6
commit 079b5e57ef
10 changed files with 84 additions and 63 deletions

View File

@@ -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
}