Skip to content

Commit a8ad32d

Browse files
committed
[ConstraintLocator] Add a new locator accessor to check whether it belongs to key path component result
1 parent 566abca commit a8ad32d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/Sema/ConstraintLocator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ class ConstraintLocator : public llvm::FoldingSetNode {
204204
/// components.
205205
bool isForKeyPathComponent() const;
206206

207+
/// Determine whether this locator points to a result type of
208+
/// a key path component.
209+
bool isForKeyPathComponentResult() const;
210+
207211
/// Determine whether this locator points to the generic parameter.
208212
bool isForGenericParameter() const;
209213

lib/Sema/ConstraintLocator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ bool ConstraintLocator::isForKeyPathComponent() const {
177177
});
178178
}
179179

180+
bool ConstraintLocator::isForKeyPathComponentResult() const {
181+
return isLastElement<LocatorPathElt::KeyPathComponentResult>();
182+
}
183+
180184
bool ConstraintLocator::isForGenericParameter() const {
181185
return isLastElement<LocatorPathElt::GenericParameter>();
182186
}

0 commit comments

Comments
 (0)