Skip to content

Commit e3f4228

Browse files
Remove macro role trailing comma support
1 parent b1ba769 commit e3f4228

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/Parse/ParseDecl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2551,7 +2551,7 @@ Parser::parseMacroRoleAttribute(
25512551
SmallVector<TypeExpr *, 2> conformances;
25522552
auto argumentsStatus = parseList(
25532553
tok::r_paren, lParenLoc, rParenLoc,
2554-
/*AllowSepAfterLast=*/true, diag::expected_rparen_expr_list, [&] {
2554+
/*AllowSepAfterLast=*/false, diag::expected_rparen_expr_list, [&] {
25552555
ParserStatus status;
25562556

25572557
if (consumeIf(tok::code_complete)) {

test/Parse/trailing-comma.swift

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ struct S {
5757
#foo(1, 2,)
5858
}
5959

60-
// Macro Role Attribute
61-
62-
@attached(extension, conformances: OptionSet,)
63-
macro OptionSet<RawType>() = #externalMacro(module: "SwiftMacros", type: "OptionSetMacro")
64-
6560
// String Literal Interpolation
6661

6762
"\(1,)"
@@ -74,6 +69,9 @@ if #available(iOS 15,) { } // expected-error {{expected platform name}}
7469
7570
// Built-in Attributes
7671
72+
@attached(extension, conformances: OptionSet,) // expected-error {{unexpected ',' separator}}
73+
macro OptionSet<RawType>() = #externalMacro(module: "SwiftMacros", type: "OptionSetMacro")
74+
7775
@inline(never,) // expected-error {{expected declaration}} expected-error {{expected ')' in 'inline' attribute}}
7876
func foo() { }
7977

0 commit comments

Comments
 (0)