[stdlib] Mark String.init?(_: String) obsoleted in Swift 4

It is still possible to get the same behavior by providing an explicit
type context, or in a generic code, but otherwise, `String("")!` will
not compile.
This commit is contained in:
Max Moiseev
2017-05-12 22:02:15 -07:00
committed by Maxim Moiseev
parent 1b6511a41f
commit 12f8b390c1
4 changed files with 34 additions and 7 deletions

View File

@@ -361,14 +361,11 @@ StringTests.test("CompareStringsWithUnpairedSurrogates")
)
}
StringTests.test("String.init(_:String)") {
StringTests.test("String.init(_:String)/default type") {
var s = String("")
expectType(String.self, &s)
var _ = String("") as String? // should also compile, but not be the default
var _ = String("")! // unwrapping optional should also work
}
StringTests.test("[String].joined() -> String") {
let s = ["hello", "world"].joined()
_ = s == "" // should compile without error