File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1112,7 +1112,8 @@ ParserResult<Pattern> Parser::parsePattern() {
11121112 PatternCtx.setCreateSyntax (SyntaxKind::IdentifierPattern);
11131113 Identifier name;
11141114 SourceLoc loc = consumeIdentifier (name, /* diagnoseDollarPrefix=*/ true );
1115- if (Tok.isIdentifierOrUnderscore () && !Tok.isContextualDeclKeyword ())
1115+ if (Tok.isIdentifierOrUnderscore () && !Tok.isContextualDeclKeyword () &&
1116+ !Tok.isAtStartOfLine ())
11161117 diagnoseConsecutiveIDs (name.str (), loc,
11171118 introducer == VarDecl::Introducer::Let
11181119 ? " constant" : " variable" );
Original file line number Diff line number Diff line change @@ -47,3 +47,16 @@ _ = sil_witness_table // expected-error {{cannot find 'sil_witness_table' in sco
4747_ = sil_default_witness_table // expected-error {{cannot find 'sil_default_witness_table' in scope}}
4848_ = sil_coverage_map // expected-error {{cannot find 'sil_coverage_map' in scope}}
4949_ = sil_scope // expected-error {{cannot find 'sil_scope' in scope}}
50+
51+ // https://github.com/apple/swift/issues/57542
52+ // Make sure we do not parse the '_' on the newline as being part of the 'variable' identifier on the line before.
53+
54+ @propertyWrapper
55+ struct Wrapper {
56+ var wrappedValue = 0
57+ }
58+
59+ func localScope( ) {
60+ @Wrapper var variable
61+ _ = 0
62+ }
You can’t perform that action at this time.
0 commit comments