77@attached ( peer) macro m1( ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
88
99@attached ( peer) macro m2( _: Int ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
10- // expected-note@-1{{candidate has partially matching parameter list (Int) }}
10+ // expected-note@-1{{'m2' declared here }}
1111// expected-note@-2{{candidate expects value of type 'Int' for parameter #1 (got 'String')}}
1212
1313@attached ( peer) macro m2( _: Double ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
14- // expected-note@-1{{candidate has partially matching parameter list (Double)}}
15- // expected-note@-2{{candidate expects value of type 'Double' for parameter #1 (got 'String')}}
14+ // expected-note@-1{{candidate expects value of type 'Double' for parameter #1 (got 'String')}}
1615
1716@attached ( peer) macro m3( message: String ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
17+ // expected-note@-1{{'m3(message:)' declared here}}
18+
19+ @attached ( peer) macro m4( _ param1: Int , label2 param2: String ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
20+ // expected-note@-1 3 {{'m4(_:label2:)' declared here}}
21+
22+ @attached ( peer) macro m5( label1: Int , label2: String ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
23+ // expected-note@-1{{'m5(label1:label2:)' declared here}}
24+
25+ @attached ( peer) macro m6( label: Int = 42 ) = #externalMacro( module: " MacroDefinition " , type: " EmptyPeerMacro " )
1826
1927@freestanding ( expression) macro stringify< T> ( _ value: T ) -> ( T , String ) = #externalMacro( module: " MyMacros " , type: " StringifyMacro " )
2028// expected-warning@-1{{external macro implementation type 'MyMacros.StringifyMacro' could not be found for macro 'stringify'}}
2129// expected-note@-2{{'stringify' declared here}}
2230
2331@m1 struct X1 { }
2432
25- @m2 struct X2 { } // expected-error{{no exact matches in call to macro 'm2'}}
33+ @m2 struct X2 { } // expected-error{{missing argument for parameter #1 in macro expansion}}{{4-4=(<#Int#>)}}
34+
35+ @m3 struct X3 { } // expected-error{{missing argument for parameter 'message' in macro expansion}}{{4-4=(message: <#String#>)}}
36+
37+ @m4 struct X4 { } // expected-error{{missing arguments for parameters #1, 'label2' in macro expansion}}{{4-4=(<#Int#>, label2: <#String#>)}}
38+
39+ @m5 struct X5 { } // expected-error{{missing arguments for parameters 'label1', 'label2' in macro expansion}}{{4-4=(label1: <#Int#>, label2: <#String#>)}}
40+
41+ @m6 struct X6 { }
2642
2743// Check for nesting rules.
2844struct SkipNestedType {
@@ -54,6 +70,10 @@ struct TestMacroArgs {
5470
5571 @m2 ( Nested . x) struct Args5 { }
5672
73+ @m4 ( 10 ) struct Args6 { } // expected-error{{missing argument for parameter 'label2' in macro expansion}}{{9-9=, label2: <#String#>}}
74+
75+ @m4 ( label2: " test " ) struct Args7 { } // expected-error{{missing argument for parameter #1 in macro expansion}}{{7-7=<#Int#>, }}
76+
5777 struct Nested {
5878 static let x = 10
5979
@@ -62,15 +82,15 @@ struct TestMacroArgs {
6282 @m2 ( Nested . x) struct Args2 { }
6383 }
6484
65- @m3 ( message: stringify ( Nested . x) . 1 ) struct Args6 { }
85+ @m3 ( message: stringify ( Nested . x) . 1 ) struct Args8 { }
6686 // expected-error@-1{{expansion of macro 'stringify' requires leading '#'}}
6787
68- @m3 ( message: #stringify ( ) . 1 ) struct Args7 { }
88+ @m3 ( message: #stringify ( ) . 1 ) struct Args9 { }
6989 // expected-error@-1{{missing argument for parameter #1 in macro expansion}}
7090
71- @m3 ( message: #stringify ( Nested . x) . 1 ) struct Args8 { }
91+ @m3 ( message: #stringify ( Nested . x) . 1 ) struct Args10 { }
7292
7393 // Allow macros to have arbitrary generic specialization lists, but warn
7494 // https://github.com/swiftlang/swift/issues/75500
75- @m1 < UInt > struct Args9 { } // expected-warning {{cannot specialize a non-generic external macro 'm1()'}}
95+ @m1 < UInt > struct Args11 { } // expected-warning {{cannot specialize a non-generic external macro 'm1()'}}
7696}
0 commit comments