mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
includes a number of QoI things to help people write the correct code. I will commit the testcase for it as the next patch. The bulk of this patch is moving the stdlib, testsuite and validation testsuite to the new syntax. I moved a few uses of "as" patterns back to as? expressions in the stdlib as well. Swift SVN r27959
23 lines
471 B
Swift
23 lines
471 B
Swift
// RUN: %target-run-simple-swift | FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
import Foundation
|
|
|
|
func foo(f: (String) -> String) {
|
|
println(f(", "))
|
|
println(f(" • "))
|
|
}
|
|
|
|
let x: NSArray = ["foo", "bar", "bas"]
|
|
foo(x.componentsJoinedByString)
|
|
// CHECK: foo, bar, bas
|
|
// CHECK: foo • bar • bas
|
|
|
|
let a: AnyObject = x
|
|
if let componentsJoinedByString = a.componentsJoinedByString {
|
|
foo(componentsJoinedByString)
|
|
}
|
|
// CHECK: foo, bar, bas
|
|
// CHECK: foo • bar • bas
|
|
|