mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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:
@@ -329,7 +329,7 @@ func checkDecodeUTF<Codec : UnicodeCodecType>(
|
||||
var g = EOFCountingGenerator(utfStr)
|
||||
transcode(codec, UTF32.self, g,
|
||||
SinkOf {
|
||||
decoded += $0
|
||||
decoded.append($0)
|
||||
},
|
||||
stopOnError: true)
|
||||
expectGE(1, g.numTimesReturnedEOF)
|
||||
@@ -349,7 +349,7 @@ func checkDecodeUTF<Codec : UnicodeCodecType>(
|
||||
var g = EOFCountingGenerator(utfStr)
|
||||
transcode(codec, UTF32.self, g,
|
||||
SinkOf {
|
||||
decoded += $0
|
||||
decoded.append($0)
|
||||
},
|
||||
stopOnError: false)
|
||||
expectEqual(1, g.numTimesReturnedEOF)
|
||||
@@ -392,7 +392,7 @@ func checkEncodeUTF8(expected: [UInt8], scalars: [UInt32]) -> AssertionResult {
|
||||
var g = EOFCountingGenerator(scalars)
|
||||
let hadError = transcode(UTF32.self, UTF8.self, g,
|
||||
SinkOf {
|
||||
encoded += $0
|
||||
encoded.append($0)
|
||||
},
|
||||
stopOnError: true)
|
||||
expectFalse(hadError)
|
||||
@@ -2261,7 +2261,7 @@ class NonContiguousNSString : NSString {
|
||||
var g = utf8.generate()
|
||||
let hadError = transcode(UTF8.self, UTF16.self, g,
|
||||
SinkOf {
|
||||
encoded += $0
|
||||
encoded.append($0)
|
||||
},
|
||||
stopOnError: true)
|
||||
expectFalse(hadError)
|
||||
@@ -2278,7 +2278,7 @@ class NonContiguousNSString : NSString {
|
||||
var g = scalars.generate()
|
||||
let hadError = transcode(UTF32.self, UTF16.self, g,
|
||||
SinkOf {
|
||||
encoded += $0
|
||||
encoded.append($0)
|
||||
},
|
||||
stopOnError: true)
|
||||
expectFalse(hadError)
|
||||
@@ -2337,7 +2337,7 @@ StringCookedViews.test("UTF8ForContiguousUTF16") {
|
||||
var g = test.scalars.generate()
|
||||
transcode(UTF32.self, UTF16.self, g,
|
||||
SinkOf {
|
||||
backingStorage += $0
|
||||
backingStorage.append($0)
|
||||
},
|
||||
stopOnError: false)
|
||||
|
||||
@@ -2360,7 +2360,7 @@ StringCookedViews.test("UTF8ForContiguousUTF16") {
|
||||
var g = expectedScalars.generate()
|
||||
transcode(UTF32.self, UTF8.self, g,
|
||||
SinkOf {
|
||||
expected += $0
|
||||
expected.append($0)
|
||||
},
|
||||
stopOnError: false)
|
||||
|
||||
@@ -2409,7 +2409,7 @@ StringCookedViews.test("UTF8ForNonContiguousUTF16") {
|
||||
var g = expectedScalars.generate()
|
||||
transcode(UTF32.self, UTF8.self, g,
|
||||
SinkOf {
|
||||
expected += $0
|
||||
expected.append($0)
|
||||
},
|
||||
stopOnError: false)
|
||||
|
||||
@@ -2475,7 +2475,7 @@ StringCookedViews.test("UTF16") {
|
||||
var g = expectedScalars.generate()
|
||||
transcode(UTF32.self, UTF16.self, g,
|
||||
SinkOf {
|
||||
expected += $0
|
||||
expected.append($0)
|
||||
},
|
||||
stopOnError: false)
|
||||
|
||||
@@ -2490,7 +2490,7 @@ StringCookedViews.test("UTF16") {
|
||||
var g = expectedScalars.generate()
|
||||
transcode(UTF32.self, UTF16.self, g,
|
||||
SinkOf {
|
||||
expected += $0
|
||||
expected.append($0)
|
||||
},
|
||||
stopOnError: false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user