Skip to content

Commit 861d5d3

Browse files
committed
[Parser] Minor location tweak to aid the scope map.
1 parent 33d37c5 commit 861d5d3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/Parse/ParseStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ ParserResult<Stmt> Parser::parseStmtForCStyle(SourceLoc ForLoc,
22132213
// If we're missing a semicolon, try to recover.
22142214
if (Tok.isNot(tok::semi)) {
22152215
// Provide a reasonable default location for the first semicolon.
2216-
Semi1Loc = Tok.getLoc();
2216+
Semi1Loc = PreviousLoc;
22172217

22182218
if (auto *BS = ConvertClosureToBraceStmt(First.getPtrOrNull(), Context)) {
22192219
// We have seen:

test/Parse/toplevel_library_invalid.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: %target-parse-verify-swift -parse-as-library
2+
// RUN: %target-parse-verify-swift -parse-as-library -enable-astscope-lookup
23

34
let x = 42 // expected-note{{did you mean 'x'?}}
45
x + x; // expected-error {{expressions are not allowed at the top level}} expected-warning {{result of operator '+' is unused}}

0 commit comments

Comments
 (0)