Skip to content

Commit d6853c2

Browse files
committed
[ConstraintSystem] Fix locator builder directlyAt
`hasEmptyPath` in locator builder context means that there are no new elements added which is different from the materialized locator, `directlyAt` has to use `!last()` to check whether or not there are any elements in the path of this builder.
1 parent 113bfc7 commit d6853c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/swift/Sema/ConstraintLocator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,11 +1264,11 @@ class ConstraintLocatorBuilder {
12641264
template <typename E>
12651265
bool directlyAt() const {
12661266
if (auto *expr = getAnchor().dyn_cast<Expr *>())
1267-
return isa<E>(expr) && hasEmptyPath();
1267+
return isa<E>(expr) && !last();
12681268
return false;
12691269
}
12701270

1271-
/// Determine whether this builder has an empty path.
1271+
/// Determine whether this builder has an empty path (no new elements).
12721272
bool hasEmptyPath() const {
12731273
return !element;
12741274
}

0 commit comments

Comments
 (0)