Skip to content

Commit 992cc03

Browse files
committed
[SyntaxParse] Don't discard 'typealias' without identifier
Fixes round trip issue
1 parent 88f8592 commit 992cc03

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4104,8 +4104,10 @@ parseDeclTypeAlias(Parser::ParseDeclOptions Flags, DeclAttributes &Attributes) {
41044104

41054105
Status |= parseIdentifierDeclName(*this, Id, IdLoc, "typealias",
41064106
tok::colon, tok::equal);
4107-
if (Status.isError())
4107+
if (Status.isError()) {
4108+
TmpCtxt->setTransparent();
41084109
return nullptr;
4110+
}
41094111

41104112
DebuggerContextChange DCC(*this, Id, DeclKind::TypeAlias);
41114113

test/Syntax/round_trip_misc.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ do {
2222
do {
2323
typealias Alias3 = () -> @objc func
2424
}
25+
do {
26+
typealias
27+
}
2528

2629
// Orphan '}' at top level
2730
}

0 commit comments

Comments
 (0)