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() {
1112
1112
PatternCtx.setCreateSyntax (SyntaxKind::IdentifierPattern);
1113
1113
Identifier name;
1114
1114
SourceLoc loc = consumeIdentifier (name, /* diagnoseDollarPrefix=*/ true );
1115
- if (Tok.isIdentifierOrUnderscore () && !Tok.isContextualDeclKeyword ())
1115
+ if (Tok.isIdentifierOrUnderscore () && !Tok.isContextualDeclKeyword () &&
1116
+ !Tok.isAtStartOfLine ())
1116
1117
diagnoseConsecutiveIDs (name.str (), loc,
1117
1118
introducer == VarDecl::Introducer::Let
1118
1119
? " 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
47
47
_ = sil_default_witness_table // expected-error {{cannot find 'sil_default_witness_table' in scope}}
48
48
_ = sil_coverage_map // expected-error {{cannot find 'sil_coverage_map' in scope}}
49
49
_ = 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