Skip to content

Commit d356a2f

Browse files
committed
a few more diagnostics.
Swift SVN r30455
1 parent e891417 commit d356a2f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: test/Constraints/diagnostics.swift

+21
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ f8(1.0) // expected-error {{cannot invoke 'f8' with an argument list of
324324
class CurriedClass {
325325
func method1() {}
326326
func method2(a: Int)(b : Int) {}
327+
func method3(a: Int, b : Int) {}
327328
}
328329

329330
let c = CurriedClass()
@@ -345,8 +346,28 @@ CurriedClass.method1(2.0)(1) // expected-error {{cannot invoke 'method1' w
345346
CurriedClass.method2(c)(32)(b: 1)
346347
_ = CurriedClass.method2(c)
347348
_ = CurriedClass.method2(c)(32)
349+
_ = CurriedClass.method2(1,2) // expected-error {{extra argument in call}}
348350
CurriedClass.method2(c)(1.0)(b: 1) // expected-error {{cannot invoke value of type '(Int) -> (b: Int) -> ()' with argument list '(Double)'}}
349351
CurriedClass.method2(c)(1)(b: 1.0) // expected-error {{cannot invoke value of type '(b: Int) -> ()' with argument list '(b: Double)'}}
350352
CurriedClass.method2(c)(2)(c: 1.0) // expected-error {{cannot invoke value of type '(b: Int) -> ()' with argument list '(c: Double)'}}
351353

352354

355+
CurriedClass.method3(c)(32, b: 1)
356+
_ = CurriedClass.method3(c)
357+
_ = CurriedClass.method3(c)(1, 2) // expected-error {{missing argument label 'b:' in call}}
358+
_ = CurriedClass.method3(c)(1, b: 2)(32) // expected-error {{cannot call value of non-function type '()'}}
359+
_ = CurriedClass.method3(1, 2) // expected-error {{extra argument in call}}
360+
CurriedClass.method3(c)(1.0, b: 1) // expected-error {{cannot invoke value of type '(Int, b: Int) -> ()' with argument list '(Double, b: Int)'}}
361+
CurriedClass.method3(c)(1) // expected-error {{cannot invoke value of type '(Int, b: Int) -> ()' with argument list '(Int)'}}
362+
CurriedClass.method3(c)(c: 1.0) // expected-error {{missing argument for parameter 'b' in call}}
363+
364+
365+
extension CurriedClass {
366+
func f() {
367+
method3(1, b: 2)
368+
method3() // expected-error {{missing argument for parameter #1 in call}}
369+
370+
method3(42) // expected-error {{cannot invoke 'method3' with an argument list of type '(Int)'}}
371+
method3(self) // expected-error {{missing argument for parameter 'b' in call}}
372+
}
373+
}

0 commit comments

Comments
 (0)