mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
committed by
Maxim Moiseev
parent
1b6511a41f
commit
12f8b390c1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user