File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -2018,6 +2018,14 @@ extension Parser {
2018
2018
let poundKeyword = self . consumeAnyToken ( )
2019
2019
let ( unexpectedBeforeMacro, macro) = self . expectIdentifier ( )
2020
2020
2021
+ // Parse the optional generic argument list.
2022
+ let generics : RawGenericArgumentClauseSyntax ?
2023
+ if self . lookahead ( ) . canParseAsGenericArgumentList ( ) {
2024
+ generics = self . parseGenericArguments ( )
2025
+ } else {
2026
+ generics = nil
2027
+ }
2028
+
2021
2029
// Parse the optional parenthesized argument list.
2022
2030
let leftParen = self . consume ( if: . leftParen, where: { !$0. isAtStartOfLine } )
2023
2031
let args : [ RawTupleExprElementSyntax ]
@@ -2048,6 +2056,7 @@ extension Parser {
2048
2056
poundToken: poundKeyword,
2049
2057
unexpectedBeforeMacro,
2050
2058
macro: macro,
2059
+ genericArguments: generics,
2051
2060
leftParen: leftParen,
2052
2061
argumentList: RawTupleExprElementListSyntax (
2053
2062
elements: args, arena: self . arena
Original file line number Diff line number Diff line change @@ -1163,6 +1163,14 @@ extension Parser {
1163
1163
let poundKeyword = self . consumeAnyToken ( )
1164
1164
let ( unexpectedBeforeMacro, macro) = self . expectIdentifier ( )
1165
1165
1166
+ // Parse the optional generic argument list.
1167
+ let generics : RawGenericArgumentClauseSyntax ?
1168
+ if self . lookahead ( ) . canParseAsGenericArgumentList ( ) {
1169
+ generics = self . parseGenericArguments ( )
1170
+ } else {
1171
+ generics = nil
1172
+ }
1173
+
1166
1174
// Parse the optional parenthesized argument list.
1167
1175
let leftParen = self . consume ( if: . leftParen, where: { !$0. isAtStartOfLine } )
1168
1176
let args : [ RawTupleExprElementSyntax ]
@@ -1191,6 +1199,7 @@ extension Parser {
1191
1199
poundToken: poundKeyword,
1192
1200
unexpectedBeforeMacro,
1193
1201
macro: macro,
1202
+ genericArguments: generics,
1194
1203
leftParen: leftParen,
1195
1204
argumentList: RawTupleExprElementListSyntax (
1196
1205
elements: args, arena: self . arena
Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ extension MacroExpansionDeclSyntax {
49
49
MacroExpansionExprSyntax (
50
50
unexpectedBeforePoundToken, poundToken: poundToken,
51
51
unexpectedBetweenPoundTokenAndMacro, macro: macro,
52
- unexpectedBetweenMacroAndLeftParen, leftParen: leftParen,
52
+ genericArguments: genericArguments,
53
+ unexpectedBetweenGenericArgumentsAndLeftParen, leftParen: leftParen,
53
54
unexpectedBetweenLeftParenAndArgumentList, argumentList: argumentList,
54
55
unexpectedBetweenArgumentListAndRightParen, rightParen: rightParen,
55
56
unexpectedBetweenRightParenAndTrailingClosure,
Original file line number Diff line number Diff line change @@ -343,6 +343,12 @@ final class ExpressionTests: XCTestCase {
343
343
additionalTrailingClosures: nil ) ) ,
344
344
trailingComma: . commaToken( ) ) ) ,
345
345
substructureAfterMarker: " 1️⃣ " )
346
+
347
+ AssertParse (
348
+ """
349
+ #fancyMacro<Arg1, Arg2>(hello: " me " )
350
+ """
351
+ )
346
352
}
347
353
348
354
func testInterpolatedStringLiterals( ) {
You can’t perform that action at this time.
0 commit comments