Skip to content

Commit 9ab7702

Browse files
committed
[ConstraintSystem] NFC: Add an accessor to determine whether type variable represents a key path
1 parent b7a7024 commit 9ab7702

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ class TypeVariableType::Implementation {
356356
/// Determine whether this type variable represents a closure result type.
357357
bool isClosureResultType() const;
358358

359+
/// Determine whether this type variable represents
360+
/// a type of a key path expression.
361+
bool isKeyPathType() const;
362+
359363
/// Retrieve the representative of the equivalence class to which this
360364
/// type variable belongs.
361365
///

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ bool TypeVariableType::Implementation::isClosureResultType() const {
111111
locator->isLastElement<LocatorPathElt::ClosureResult>();
112112
}
113113

114+
bool TypeVariableType::Implementation::isKeyPathType() const {
115+
return locator && locator->isKeyPathType();
116+
}
117+
114118
void *operator new(size_t bytes, ConstraintSystem& cs,
115119
size_t alignment) {
116120
return cs.getAllocator().Allocate(bytes, alignment);

0 commit comments

Comments
 (0)