Skip to content

Commit b26dd11

Browse files
committed
[incrParse] Fix swift-syntax-test not complaining about unexpected reparsed functions
1 parent a137e0d commit b26dd11

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/Parse/SyntaxParsingCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ llvm::Optional<Syntax> SyntaxParsingCache::lookUp(size_t NewPosition,
116116
size_t OldPosition = NewPosition;
117117
for (auto I = Edits.rbegin(), E = Edits.rend(); I != E; ++I) {
118118
auto Edit = *I;
119-
if (Edit.End < OldPosition) {
119+
if (Edit.End <= OldPosition) {
120120
OldPosition =
121121
OldPosition - Edit.ReplacementLength + Edit.originalLength();
122122
}

test/incrParse/reuse.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ func start() {}
1717
let g: Int
1818
<reparse ADD_PROPERTY>}</reparse ADD_PROPERTY>
1919

20-
21-
<reparse WRAP_IN_CLASS><<WRAP_IN_CLASS<|||class Foo {>>></reparse WRAP_IN_CLASS>
20+
// FIXME: The functions inside the class should not need to get reparsed
21+
<<WRAP_IN_CLASS<|||class Foo {>>>
2222
func foo1() {
2323
print("Hello Foo!")
2424
}
@@ -37,4 +37,4 @@ func start() {}
3737
print("I can compute Pi as well:")
3838
bar1()
3939
}
40-
}
40+
}

tools/swift-syntax-test/swift-syntax-test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ bool verifyReusedRegions(ByteBasedSourceRangeSet ExpectedReparseRegions,
515515
// about reparsed whitespaces.
516516
auto RangeStr =
517517
CharSourceRange(SourceMgr, ReparseRange.Start, ReparseRange.End).str();
518-
llvm::Regex WhitespaceOnlyRegex("^\\s*$", llvm::Regex::Newline);
518+
llvm::Regex WhitespaceOnlyRegex("^[ \t\r\n]*$");
519519
if (WhitespaceOnlyRegex.match(RangeStr)) {
520520
continue;
521521
}

0 commit comments

Comments
 (0)