Skip to content

Commit 7611f3f

Browse files
authored
Merge pull request #59343 from xedin/rdar-94619388-5.7
[5.7][TypeChecker/CodeCompletion] Re-introduce expression sanitization bef…
2 parents 5d998b8 + 8997d3e commit 7611f3f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/Sema/TypeCheckCodeCompletion.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,11 @@ bool TypeChecker::typeCheckForCodeCompletion(
575575
if (!node)
576576
return false;
577577

578+
if (auto *expr = getAsExpr(node)) {
579+
node = expr->walk(SanitizeExpr(Context,
580+
/*shouldReusePrecheckedType=*/false));
581+
}
582+
578583
CompletionContextFinder contextAnalyzer(node, DC);
579584

580585
// If there was no completion expr (e.g. if the code completion location was
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token COMPLETE
2+
3+
func foo(closure: (String) -> Void) -> String? {
4+
return nil
5+
}
6+
7+
func test() {
8+
if let key = foo(closure: { str in str.suffix(2) == #^COMPLETE^#

0 commit comments

Comments
 (0)