mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This reverts commits:b96e06da44,8f2fbdc93a,93b6962478,64024118f4,a759ca9141,3434f9642b,9f33429891,47c043e8a6. This commit leaves 'var' on function parameters as a warning to be merged into Swift 2.2. For Swift 3, this will be an error, to be converted in a follow-up.
14 lines
848 B
Swift
14 lines
848 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
// Warn about non-trailing closures followed by parameters with
|
|
// default arguments.
|
|
func f1(f: () -> (), bar: Int = 10) { } // expected-warning{{closure parameter prior to parameters with default arguments will not be treated as a trailing closure}}
|
|
func f2(f: (() -> ())!, bar: Int = 10, wibble: Int = 17) { } // expected-warning{{closure parameter prior to parameters with default arguments will not be treated as a trailing closure}}
|
|
func f3(f: (() -> ())?, bar: Int = 10) { } // expected-warning{{closure parameter prior to parameters with default arguments will not be treated as a trailing closure}}
|
|
|
|
// An extra set of parentheses suppresses the warning.
|
|
func g1(f: (() -> ()), bar: Int = 10) { } // no-warning
|
|
|
|
// Stop at the first closure.
|
|
func g2(f: () -> (), g: (() -> ())? = nil) { } // no-warning
|