Skip to content

Commit 41eebd2

Browse files
committed
[SyntaxParse] Fix round-trip issue in tuple type parsing
1 parent bdda81c commit 41eebd2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/Parse/ParseType.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,8 @@ Parser::TypeResult Parser::parseTypeTupleBody() {
10941094
} else {
10951095
if (!Backtracking)
10961096
diagnose(Tok, diag::expected_parameter_colon);
1097+
NameLoc = SourceLoc();
1098+
SecondNameLoc = SourceLoc();
10971099
}
10981100
} else if (InOut) {
10991101
// If we don't have labels, 'inout' is not a obsoleted use.

test/Syntax/round_trip_misc.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@ class C {
55
typealias Inner: Foo = Int
66

77
typealias Alias1 = [Generic<Int
8-
typealias Alias2 = () -> (a b: [Generic<Int
8+
99

1010
// Implict accessor with attribute at the top of its body.
1111
var x: Int {
1212
@objc
1313
func f() {}
1414
}
1515
}
16+
do {
17+
typealias Alias2 = () -> (a b: [Generic<Int
18+
}
19+
do {
20+
typealias Alias3 = (a b C,
21+
}
1622

1723
// Orphan '}' at top level
1824
}

0 commit comments

Comments
 (0)