Skip to content

Commit 27ded64

Browse files
authored
Merge pull request #26974 from rintaro/syntaxparse-roundtrip2
[SyntaxParse] Don't discard 'typealias' without identifier
2 parents 42fdacc + 992cc03 commit 27ded64

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
@@ -4135,8 +4135,10 @@ parseDeclTypeAlias(Parser::ParseDeclOptions Flags, DeclAttributes &Attributes) {
41354135

41364136
Status |= parseIdentifierDeclName(*this, Id, IdLoc, "typealias",
41374137
tok::colon, tok::equal);
4138-
if (Status.isError())
4138+
if (Status.isError()) {
4139+
TmpCtxt->setTransparent();
41394140
return nullptr;
4141+
}
41404142

41414143
DebuggerContextChange DCC(*this, Id, DeclKind::TypeAlias);
41424144

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)