Skip to content

Commit ca9056a

Browse files
committed
[TypeChecker] Add method to check whether a type variable represents a code completion token
1 parent ce2c771 commit ca9056a

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
@@ -386,6 +386,10 @@ class TypeVariableType::Implementation {
386386

387387
bool isTypeSequence() const;
388388

389+
/// Determine whether this type variable represents a code completion
390+
/// expression.
391+
bool isCodeCompletionToken() const;
392+
389393
/// Retrieve the representative of the equivalence class to which this
390394
/// type variable belongs.
391395
///

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ bool TypeVariableType::Implementation::isTypeSequence() const {
130130
&& locator->getGenericParameter()->isTypeSequence();
131131
}
132132

133+
bool TypeVariableType::Implementation::isCodeCompletionToken() const {
134+
return locator && locator->directlyAt<CodeCompletionExpr>();
135+
}
136+
133137
void *operator new(size_t bytes, ConstraintSystem& cs,
134138
size_t alignment) {
135139
return cs.getAllocator().Allocate(bytes, alignment);

0 commit comments

Comments
 (0)