 
     f(0, bb: 1, 2)
     // expected-error@-1:6 {{missing argument label 'aa:' in call}}
+
+    f(xx: 1, 2, 3)
+    // expected-error@-1:7 {{missing argument for parameter 'aa' in call}}
+    // expected-error@-2:17 {{extra argument in call}}
+
+    f(1, xx: 2, 3)
+    // expected-error@-1:7 {{missing argument for parameter 'aa' in call}}
+    // expected-error@-2:17 {{extra argument in call}}
+
+    f(1, 2, xx: 3)
+    // expected-error@-1:8 {{missing argument for parameter 'bb' in call}}
+    // expected-error@-2:17 {{extra argument 'xx' in call}}
+  }
+
+  do {
+    func f(aa: Int, bb: Int, cc: Int) { }
+
+    f(1, aa: 2, bb: 3)
+    // expected-error@-1 {{incorrect argument labels in call (have '_:aa:bb:', expected 'aa:bb:cc:')}}
+
+    f(1, bb: 2, aa: 3)
+    // expected-error@-1 {{incorrect argument labels in call (have '_:bb:aa:', expected 'aa:bb:cc:')}}
+
+    f(aa: 1, 2, bb: 3)
+    // expected-error@-1 {{incorrect argument labels in call (have 'aa:_:bb:', expected 'aa:bb:cc:')}}
+
+    f(aa: 1, bb: 2, 3)
+    // expected-error@-1 {{missing argument label 'cc:' in call}}
   }
 
   do {

    // expected-note@+1 *{{'f(aa:_:_:)' declared here}}
    func f(aa: Int, _ bb: Int, _ cc: Int) {}

    f(0, 1)
    // expected-error@-1:7 {{missing argument for parameter 'aa' in call}}
  }

  do {

    func f(_ aa: Int, _ bb: Int = 81, cc: Int = 82, _ dd: Int) {}

    f(0, cc: 2, 3) // ok

    f(cc: 1, 2, 3, 4)
    // expected-error@-1 {{unnamed argument #3 must precede argument 'cc'}}
  }

  do {
    func f(_ aa: Int, _ bb: Int, cc: Int, dd: Int) { }
    // expected-note@-1 6 {{'f(_:_:cc:dd:)' declared here}}

    f(1, xx: 2)
    // expected-error@-1 {{extraneous argument label 'xx:' in call}}
    // expected-error@-2:6 {{missing arguments for parameters 'cc', 'dd' in call}}

    f(xx: 1, 2)
    // expected-error@-1:6 {{missing arguments for parameters 'cc', 'dd' in call}}
    // expected-error@-2 {{extraneous argument label 'xx:' in call}}

    f(1, xx: 2, cc: 3)
    // expected-error@-1 {{extraneous argument label 'xx:' in call}}
    // expected-error@-2:22 {{missing argument for parameter 'dd' in call}}

    f(1, xx: 2, dd: 3)
    // expected-error@-1 {{incorrect argument labels in call (have '_:xx:dd:', expected '_:_:cc:dd:')}}
    // expected-error@-2:15 {{missing argument for parameter 'cc' in call}}

    f(xx: 1, 2, cc: 3)
    // expected-error@-1 {{extraneous argument label 'xx:' in call}}
    // expected-error@-2:22 {{missing argument for parameter 'dd' in call}}

    f(xx: 1, 2, dd: 3)
    // expected-error@-1 {{incorrect argument labels in call (have 'xx:_:dd:', expected '_:_:cc:dd:')}}
    // expected-error@-2:15 {{missing argument for parameter 'cc' in call}}

    f(1, xx: 2, cc: 3, dd: 4)
    // expected-error@-1:6 {{extraneous argument label 'xx:' in call}}

    f(xx: 1, 2, cc: 3, dd: 4)
    // expected-error@-1:6 {{extraneous argument label 'xx:' in call}}
  }

  do {
    func f(_ aa: Int, bb: Int = 82, _ cc: Int, _ dd: Int) { }

    f(1, bb: 2, 3, 4) // ok

    f(1, 2, bb: 3, 4)
    // expected-error@-1 {{argument 'bb' must precede unnamed argument #2}}
  }

  do {
    func f(aa: Int, _ bb: Int, cc: Int, _ dd: Int) { }
    // expected-note@-1 3 {{'f(aa:_:cc:_:)' declared here}}

    f(1)
    // expected-error@-1:7 {{missing arguments for parameters 'aa', 'cc', #4 in call}}

    f(1, 2)
    // expected-error@-1:6 {{missing arguments for parameters 'aa', 'cc' in call}}

    f(1, 2, 3)
    // expected-error@-1 {{missing argument labels 'aa:cc:' in call}}
    // expected-error@-2:11 {{missing argument for parameter 'cc' in call}}

    f(1, 2, 3, 4)
    // expected-error@-1:6 {{missing argument labels 'aa:cc:' in call}}

    f(1, 2, 3, 4, 5)
    // expected-error@-1:19 {{extra argument in call}}
  }

  do {
    func f(aa: Int, bb: Int, _ cc: Int, _ dd: Int) { }
    // expected-note@-1 6 {{'f(aa:bb:_:_:)' declared here}}

    f(1, xx: 2)
    // expected-error@-1:6 {{missing arguments for parameters 'aa', 'bb' in call}}
    // expected-error@-2 {{incorrect argument labels in call (have '_:xx:', expected 'aa:bb:_:_:')}}

    f(xx: 1, 2)
    // expected-error@-1 {{incorrect argument labels in call (have 'xx:_:', expected 'aa:bb:_:_:')}}
    // expected-error@-2:6 {{missing arguments for parameters 'aa', 'bb' in call}}

    f(bb: 1, 2, xx: 3)
    // expected-error@-1:7 {{missing argument for parameter 'aa' in call}}

    f(bb: 1, xx: 2, 3)
    // expected-error@-1:7 {{missing argument for parameter 'aa' in call}}

    f(aa: 1, 2, xx: 3)
    // expected-error@-1:12 {{missing argument for parameter 'bb' in call}}

    f(aa: 1, xx: 2, 3)
    // expected-error@-1 {{incorrect argument label in call (have 'aa:xx:_:', expected 'aa:bb:_:_:')}}
    // expected-error@-2:12 {{missing argument for parameter 'bb' in call}}

    f(aa: 1, bb: 2, 3, xx: 4)
    // expected-error@-1 {{extraneous argument label 'xx:' in call}}

    f(aa: 1, bb: 2, xx: 3, 4)
    // expected-error@-1 {{extraneous argument label 'xx:' in call}}
  }

  do {
    func f(_ aa: Int, bb: Int, _ cc: Int, dd: Int, _ ee: Int) { }

    f(1, bb: 2, 3, 4, dd: 5)
    // expected-error@-1:23 {{argument 'dd' must precede unnamed argument #4}}

    f(1, dd: 2, 3, 4, bb: 5)
    // expected-error@-1 {{incorrect argument labels in call (have '_:dd:_:_:bb:', expected '_:bb:_:dd:_:')}}

    f(1, bb: 2, 3, dd: 4, 5) // ok

    f(1, dd: 2, 3, bb: 4, 5)
    // expected-error@-1 {{incorrect argument labels in call (have '_:dd:_:bb:_:', expected '_:bb:_:dd:_:')}}

    f(1, 2, bb: 3, 4, dd: 5, 6)
    // expected-error@-1:30 {{extra argument in call}}

    f(1, bb: 2, 3, 4, dd: 5, 6)
    // expected-error@-1:30 {{extra argument in call}}

    f(1, dd: 2, 3, 4, bb: 5, 6)
    // expected-error@-1:30 {{extra argument in call}}
  }
}

