Skip to content

Commit 8292c7d

Browse files
committed
[ConstraintSystem] Add a way to check whether type variable represents a key path root type
1 parent 2ef2659 commit 8292c7d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/Sema/ConstraintSystem.h

+4
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ class TypeVariableType::Implementation {
491491
/// a type of a key path expression.
492492
bool isKeyPathType() const;
493493

494+
/// Determine whether this type variable represents a root type of a key path
495+
/// expression.
496+
bool isKeyPathRoot() const;
497+
494498
/// Determine whether this type variable represents a value type of a key path
495499
/// expression.
496500
bool isKeyPathValue() const;

lib/Sema/TypeCheckConstraints.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ bool TypeVariableType::Implementation::isKeyPathType() const {
144144
return locator && locator->isKeyPathType();
145145
}
146146

147+
bool TypeVariableType::Implementation::isKeyPathRoot() const {
148+
return locator && locator->isKeyPathRoot();
149+
}
150+
147151
bool TypeVariableType::Implementation::isKeyPathValue() const {
148152
return locator && locator->isKeyPathValue();
149153
}

0 commit comments

Comments
 (0)