Skip to content

Commit 0cc0f7a

Browse files
author
Jan Svoboda
committed
Handle failed tuple parsing
1 parent c2a2388 commit 0cc0f7a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Parse/ASTGen.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,15 @@ TypeRepr *ASTGen::generate(UnknownTypeSyntax Type, SourceLoc &Loc) {
480480
}
481481
}
482482

483+
if (ChildrenCount >= 1) {
484+
auto LParen = Type.getChild(0)->getAs<TokenSyntax>();
485+
if (LParen && LParen->getTokenKind() == tok::l_paren) {
486+
auto LParenLoc = advanceLocBegin(Loc, *LParen);
487+
auto EndLoc = advanceLocBegin(Loc, *Type.getChild(Type.getNumChildren() - 1));
488+
return TupleTypeRepr::createEmpty(Context, {LParenLoc, EndLoc});
489+
}
490+
}
491+
483492
// let's hope the main `generate` method can find this node in the type map
484493
return nullptr;
485494
}

0 commit comments

Comments
 (0)