mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #34620 from AnthonyLatsis/parse-misc
Parse: Only diagnose dollar-prefixed identifiers that are Swift declarations
This commit is contained in:
@@ -975,7 +975,7 @@ ParserResult<Pattern> Parser::parsePattern() {
|
||||
case tok::identifier: {
|
||||
PatternCtx.setCreateSyntax(SyntaxKind::IdentifierPattern);
|
||||
Identifier name;
|
||||
SourceLoc loc = consumeIdentifier(&name);
|
||||
SourceLoc loc = consumeIdentifier(name, /*diagnoseDollarPrefix=*/true);
|
||||
if (Tok.isIdentifierOrUnderscore() && !Tok.isContextualDeclKeyword())
|
||||
diagnoseConsecutiveIDs(name.str(), loc,
|
||||
introducer == VarDecl::Introducer::Let
|
||||
@@ -1054,7 +1054,7 @@ Parser::parsePatternTupleElement() {
|
||||
|
||||
// If the tuple element has a label, parse it.
|
||||
if (Tok.is(tok::identifier) && peekToken().is(tok::colon)) {
|
||||
LabelLoc = consumeIdentifier(&Label);
|
||||
LabelLoc = consumeIdentifier(Label, /*diagnoseDollarPrefix=*/true);
|
||||
consumeToken(tok::colon);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user