Files
swift-mirror/test/Constraints/function.swift
Chris Lattner bc481f0fe1 implement <rdar://problem/16859927> remove the underscore in "auto_closure"
autoclosure is one work, not two.



Swift SVN r20253
2014-07-21 15:23:50 +00:00

35 lines
652 B
Swift

// RUN: %swift -parse -verify %s
func f0(x: Float) -> Float {}
func f1(x: Float) -> Float {}
func f2(x: @autoclosure () -> Float) {}
var f : Float
f0(f0(f))
f0(1)
f1(f1(f))
f2(f)
f2(1.0)
func call_lvalue(rhs: @autoclosure ()->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")