Skip to content

Commit b2c6673

Browse files
committed
[Parse] Match behaviour of non-delayed parsing when a RB is missing
1 parent 94cbc99 commit b2c6673

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
@@ -5174,7 +5174,9 @@ bool Parser::delayParsingDeclList(SourceLoc LBLoc, SourceLoc &RBLoc,
51745174
if (Tok.is(tok::r_brace)) {
51755175
RBLoc = consumeToken();
51765176
} else {
5177-
RBLoc = Tok.getLoc();
5177+
// Non-delayed parsing would set the RB location to the LB if it is missing,
5178+
// match that behaviour here
5179+
RBLoc = LBLoc;
51785180
error = true;
51795181
}
51805182
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)