mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Most tests were using %swift or similar substitutions, which did not include the target triple and SDK. The driver was defaulting to the host OS. Thus, we could not run the tests when the standard library was not built for OS X. Swift SVN r24504
35 lines
654 B
Swift
35 lines
654 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
func f0(x: Float) -> Float {}
|
|
func f1(x: Float) -> Float {}
|
|
func f2(@autoclosure x: () -> Float) {}
|
|
|
|
var f : Float
|
|
|
|
f0(f0(f))
|
|
f0(1)
|
|
f1(f1(f))
|
|
f2(f)
|
|
f2(1.0)
|
|
|
|
func call_lvalue(@autoclosure rhs: ()->Bool) -> Bool {
|
|
return rhs()
|
|
}
|
|
|
|
// Function returns
|
|
func weirdCast<T, U>(x: T) -> U {}
|
|
|
|
func ff() -> (Int) -> (Float) { return weirdCast }
|
|
|
|
// Block <-> function conversions
|
|
|
|
var funct: String -> String = { $0 }
|
|
var block: @objc_block String -> String = funct
|
|
funct = block
|
|
block = funct
|
|
|
|
// Application of implicitly unwrapped optional functions
|
|
|
|
var optFunc: (String -> String)! = { $0 }
|
|
var s: String = optFunc("hi")
|