mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
conversion failures, making a bunch of diagnostics more specific and useful. UnavoidableFailures can be very helpful, but they can also be the first constraint failure that the system happened to come across... which is not always the most meaningful one. CSDiag's expr processing machinery has a generally better way of narrowing down which ones make the most sense. Swift SVN r30647
15 lines
776 B
Swift
15 lines
776 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
func simple_default_args() {
|
|
let _ : (Int) -> Int = {(x : Int = 1) in x+1} // expected-error{{default argument is only permitted for a non-curried function parameter}}
|
|
let _ : () -> Int = {(x : Int = 1) in x+1} // expected-error{{'(Int) -> Int' is not convertible to '() -> Int'}} expected-error {{default argument is only permitted for a non-curried function parameter}}
|
|
let _ : () -> Int = {(x : Int) in x+1} // expected-error{{'(Int) -> Int' is not convertible to '() -> Int'}}
|
|
}
|
|
|
|
func func_default_args() {
|
|
func has_default_args(x x: Int = 1) -> Int { return x+1 }
|
|
var _ : (Int) -> Int = has_default_args // okay
|
|
var _ : () -> Int = has_default_args // expected-error{{(x: Int) -> Int' is not convertible to '() -> Int}}
|
|
}
|
|
|