@@ -10,8 +10,7 @@ let dict2: [Character: _] = ["h": 0]
1010
1111let arr = [ _] ( repeating: " hi " , count: 3 )
1212
13- func foo( _ arr: [ _ ] = [ 0 ] ) { } // expected-error {{type placeholder may not appear in top-level parameter}}
14- // expected-note@-1 {{replace the placeholder with the inferred type 'Int'}}
13+ func foo( _ arr: [ _ ] = [ 0 ] ) { } // expected-error {{type placeholder not allowed here}}
1514
1615let foo = _. foo // expected-error {{type placeholder not allowed here}}
1716let zero : _ = . zero // expected-error {{cannot infer contextual base in reference to member 'zero'}}
@@ -78,33 +77,25 @@ where T: ExpressibleByIntegerLiteral, U: ExpressibleByIntegerLiteral {
7877}
7978
8079extension Bar {
81- func frobnicate2( ) -> Bar < _ , _ > { // expected-error {{type placeholder may not appear in function return type}}
82- // expected-note@-1 {{replace the placeholder with the inferred type 'T'}}
83- // expected-note@-2 {{replace the placeholder with the inferred type 'U'}}
80+ func frobnicate2( ) -> Bar < _ , _ > { // expected-error {{type placeholder not allowed here}}
8481 return Bar ( t: 42 , u: 42 )
8582 }
8683 func frobnicate3( ) -> Bar {
8784 return Bar < _ , _ > ( t: 42 , u: 42 )
8885 }
89- func frobnicate4( ) -> Bar < _ , _ > { // expected-error {{type placeholder may not appear in function return type}}
90- // expected-note@-1 {{replace the placeholder with the inferred type 'Int'}}
91- // expected-note@-2 {{replace the placeholder with the inferred type 'Int'}}
86+ func frobnicate4( ) -> Bar < _ , _ > { // expected-error {{type placeholder not allowed here}}
9287 return Bar < _ , _ > ( t: 42 , u: 42 )
9388 }
94- func frobnicate5( ) -> Bar < _ , U > { // expected-error {{type placeholder may not appear in function return type}}
95- // expected-note@-1 {{replace the placeholder with the inferred type 'T'}}
89+ func frobnicate5( ) -> Bar < _ , U > { // expected-error {{type placeholder not allowed here}}
9690 return Bar ( t: 42 , u: 42 )
9791 }
9892 func frobnicate6( ) -> Bar {
9993 return Bar < _ , U > ( t: 42 , u: 42 )
10094 }
101- func frobnicate7( ) -> Bar < _ , _ > { // expected-error {{type placeholder may not appear in function return type}}
102- // expected-note@-1 {{replace the placeholder with the inferred type 'Int'}}
103- // expected-note@-2 {{replace the placeholder with the inferred type 'U'}}
95+ func frobnicate7( ) -> Bar < _ , _ > { // expected-error {{type placeholder not allowed here}}
10496 return Bar < _ , U > ( t: 42 , u: 42 )
10597 }
106- func frobnicate8( ) -> Bar < _ , U > { // expected-error {{type placeholder may not appear in function return type}}
107- // expected-note@-1 {{replace the placeholder with the inferred type 'Int'}}
98+ func frobnicate8( ) -> Bar < _ , U > { // expected-error {{type placeholder not allowed here}}
10899 return Bar < _ , _ > ( t: 42 , u: 42 )
109100 }
110101}
@@ -244,11 +235,11 @@ let _: SetFailureType<Int, String> = Just<Int>().setFailureType(to: _.self).setF
244235// diagnostic.
245236func mismatchedDefault< T> ( _ x: [ _ ] = [ String: T] ( ) ) { } // expected-error {{type placeholder not allowed here}}
246237
247- func mismatchedReturnTypes( ) -> _ { // expected-error {{type placeholder may not appear in function return type }}
238+ func mismatchedReturnTypes( ) -> _ { // expected-error {{type placeholder not allowed here }}
248239 if true {
249- return " " // expected-note@-2 {{replace the placeholder with the inferred type 'String'}}
240+ return " "
250241 } else {
251- return 0.5 // expected-note@-4 {{replace the placeholder with the inferred type 'Double'}}
242+ return 0.5
252243 }
253244}
254245
@@ -261,9 +252,8 @@ func opaque() -> some _ { // expected-error {{type placeholder not allowed here}
261252}
262253
263254enum EnumWithPlaceholders {
264- case topLevelPlaceholder( x: _ ) // expected-error {{type placeholder may not appear in top-level parameter}}
265- case placeholderWithDefault( x: _ = 5 ) // expected-error {{type placeholder may not appear in top-level parameter}}
266- // expected-note@-1 {{replace the placeholder with the inferred type 'Int'}}
255+ case topLevelPlaceholder( x: _ ) // expected-error {{type placeholder not allowed here}}
256+ case placeholderWithDefault( x: _ = 5 ) // expected-error {{type placeholder not allowed here}}
267257}
268258
269259func deferredInit( _ c: Bool ) {
@@ -303,30 +293,29 @@ protocol TestPlaceholderRequirement {
303293 subscript( ) -> _ { get } // expected-error {{type placeholder not allowed here}}
304294}
305295
306- func testPlaceholderFn1( _: _ ) { } // expected-error {{type placeholder may not appear in top-level parameter }}
307- func testPlaceholderFn2( ) -> _ { } // expected-error {{type placeholder may not appear in function return type }}
296+ func testPlaceholderFn1( _: _ ) { } // expected-error {{type placeholder not allowed here }}
297+ func testPlaceholderFn2( ) -> _ { } // expected-error {{type placeholder not allowed here }}
308298
309299var testPlaceholderComputed1 : _ { 0 } // expected-error {{type placeholder not allowed here}}
310300var testPlaceholderComputed2 : [ _ ] { [ 0 ] } // expected-error {{type placeholder not allowed here}}
311301
312302struct TestPlaceholderSubscript {
313- // FIXME: Shouldn't diagnose twice.
314- subscript( _: _ ) -> Void { ( ) } // expected-error 2{{type placeholder may not appear in top-level parameter}}
315- subscript( _: [ _ ] ) -> Void { ( ) } // expected-error 2{{type placeholder may not appear in top-level parameter}}
303+ subscript( _: _ ) -> Void { ( ) } // expected-error {{type placeholder not allowed here}}
304+ subscript( _: [ _ ] ) -> Void { ( ) } // expected-error {{type placeholder not allowed here}}
316305 subscript( ) -> _ { ( ) } // expected-error {{type placeholder not allowed here}}
317306 subscript( ) -> [ _ ] { [ 0 ] } // expected-error {{type placeholder not allowed here}}
318307}
319308
320309enum TestPlaceholderInEnumElement {
321- case a( _) // expected-error {{type placeholder may not appear in top-level parameter }}
322- case b( [ _ ] ) // expected-error {{type placeholder may not appear in top-level parameter }}
310+ case a( _) // expected-error {{type placeholder not allowed here }}
311+ case b( [ _ ] ) // expected-error {{type placeholder not allowed here }}
323312}
324313
325314@freestanding ( expression) macro testPlaceholderMacro( _ x: _ ) -> String = #file
326- // expected-error@-1 {{type placeholder may not appear in top-level parameter }}
315+ // expected-error@-1 {{type placeholder not allowed here }}
327316
328317@freestanding ( expression) macro testPlaceholderMacro( _ x: [ _ ] ) -> String = #file
329- // expected-error@-1 {{type placeholder may not appear in top-level parameter }}
318+ // expected-error@-1 {{type placeholder not allowed here }}
330319
331320@freestanding ( expression) macro testPlaceholderMacro( ) -> _ = #file
332321// expected-error@-1 {{type placeholder not allowed here}}
@@ -351,8 +340,10 @@ func usePlaceholderDecls(
351340 _ = TestPlaceholderInEnumElement . a ( 0 )
352341 _ = TestPlaceholderInEnumElement . b ( [ ] )
353342
354- _ = #testPlaceholderMacro( 0 )
355- _ = #testPlaceholderMacro( [ ] )
343+ // There are marked invalid so get removed from the overload set.
344+ // FIXME: We ought to turn them into holes instead
345+ _ = #testPlaceholderMacro( 0 ) // expected-error {{no macro named 'testPlaceholderMacro'}}
346+ _ = #testPlaceholderMacro( [ ] ) // expected-error {{no macro named 'testPlaceholderMacro'}}
356347
357348 _ = testPlaceholderFn1 ( 0 )
358349 _ = testPlaceholderFn2 ( )
0 commit comments