Skip to content

Commit ae53e8a

Browse files
committed
[CS] Remove assertion that callee locator has an anchor
When computing type relations of code completion items with respect to the context they are used in, we add a `ConstraintKind::Conversion` constraint with an empty constraint locator. This currently crashes in `hasPreconcurrencyCallee`, but actually having a null anchor doesn’t produce any issues.
1 parent ab6faa9 commit ae53e8a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,6 @@ ConstraintLocator *ConstraintSystem::getCalleeLocator(
481481
}
482482
}
483483

484-
assert(bool(anchor) && "Expected an anchor!");
485-
486484
{
487485
// If we have a locator for a member found through key path dynamic member
488486
// lookup, then we need to chop off the elements after the
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-ide-test --code-completion --code-completion-token COMPLETE --source-filename %s | %FileCheck %s
2+
3+
func foo(completionHandler completion: (@Sendable (Bool) -> Void)? = nil) {}
4+
5+
func test() {
6+
foo(completionHandler: #^COMPLETE^#nil)
7+
}
8+
9+
// CHECK: Begin completions
10+
// CHECK-DAG: Literal[Nil]/None/TypeRelation[Convertible]: nil[#(@Sendable (Bool) -> Void)?#];
11+
// CHECK: End completions

0 commit comments

Comments
 (0)