Skip to content

Commit 0831a93

Browse files
committed
[Parse] Match behaviour of non-delayed parsing when a RB is missing
1 parent b775ec2 commit 0831a93

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5173,7 +5173,9 @@ bool Parser::delayParsingDeclList(SourceLoc LBLoc, SourceLoc &RBLoc,
51735173
if (Tok.is(tok::r_brace)) {
51745174
RBLoc = consumeToken();
51755175
} else {
5176-
RBLoc = Tok.getLoc();
5176+
// Non-delayed parsing would set the RB location to the LB if it is missing,
5177+
// match that behaviour here
5178+
RBLoc = LBLoc;
51775179
error = true;
51785180
}
51795181
return error;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: not %target-swift-frontend -typecheck -experimental-skip-all-function-bodies %s
2+
3+
#if os(
4+
struct Anything {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: not %target-swift-frontend -typecheck -experimental-skip-all-function-bodies %s
2+
3+
struct A {
4+
let prop: Int = {
5+
6+
struct B {

0 commit comments

Comments
 (0)