Skip to content

Commit 11b613d

Browse files
authored
Merge pull request #76971 from tshortli/sourcekit-ast-scope-unqualified-lookup-crash
IDETool: Register SourceFile for replaced function body
2 parents 4acfd20 + af84818 commit 11b613d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

lib/IDETool/IDEInspectionInstance.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ bool IDEInspectionInstance::performCachedOperationIfPossible(
354354
nullptr
355355
}
356356
);
357+
SM.recordSourceFile(newBufferID, AFD->getParentSourceFile());
357358

358359
AFD->setBodyToBeReparsed(newBodyRange);
359360
oldSF->clearScope();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
//--- input.swift
5+
6+
//--- input2.swift
7+
func body() {
8+
9+
extension InvalidProto {}
10+
11+
//--- input3.swift
12+
func body() {
13+
14+
extension InvalidProto {}
15+
16+
struct MyStruct {
17+
18+
//--- dummy.swift
19+
20+
// RUN: %sourcekitd-test \
21+
// RUN: -req=open %t/input.swift -req-opts=syntactic_only=1 -print-raw-response == \
22+
// RUN: -req=typecontextinfo -pos=4:1 %t/input.swift -text-input %t/input2.swift -- %t/input.swift == \
23+
// RUN: -req=complete -pos=6:1 %t/input.swift -text-input %t/input3.swift -repeat-request 2 -- %t/input.swift

0 commit comments

Comments
 (0)