Skip to content

Commit 3a02b20

Browse files
authored
Merge pull request #84421 from calda/cal--trailing-comma-in-tuple-in-generic-argument
Fix support for trailing commas in tuples within generic arguments
2 parents 391a18d + 221033d commit 3a02b20

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/Parse/ParseType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ bool Parser::canParseTypeTupleBody() {
19671967
skipSingle();
19681968
}
19691969
}
1970-
} while (consumeIf(tok::comma));
1970+
} while (consumeIf(tok::comma) && Tok.isNot(tok::r_paren));
19711971
}
19721972

19731973
return consumeIf(tok::r_paren);

test/type/types.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,19 @@ let closureTypeWithTrailingCommas: (
234234
bar: String,
235235
quux: String,
236236
)
237+
238+
let _ = Array<(
239+
foo: Int,
240+
bar: String,
241+
)>()
242+
243+
let _ = Dictionary<
244+
String,
245+
Dictionary<
246+
String,
247+
Array<(
248+
foo: Int,
249+
bar: String,
250+
)>,
251+
>,
252+
>()

0 commit comments

Comments
 (0)