Skip to content

Commit de6e280

Browse files
committed
[CodeCompletion] Always activate CodeCompletionExpr
There's no reason not to activate them.
1 parent d929d38 commit de6e280

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

include/swift/AST/Expr.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -687,20 +687,13 @@ class ErrorExpr : public Expr {
687687
/// can help us preserve the context of the code completion position.
688688
class CodeCompletionExpr : public Expr {
689689
SourceRange Range;
690-
bool Activated;
691690

692691
public:
693-
CodeCompletionExpr(SourceRange Range, Type Ty = Type()) :
694-
Expr(ExprKind::CodeCompletion, /*Implicit=*/true, Ty),
695-
Range(Range) {
696-
Activated = false;
697-
}
692+
CodeCompletionExpr(SourceRange Range, Type Ty = Type())
693+
: Expr(ExprKind::CodeCompletion, /*Implicit=*/true, Ty), Range(Range) {}
698694

699695
SourceRange getSourceRange() const { return Range; }
700696

701-
bool isActivated() const { return Activated; }
702-
void setActivated() { Activated = true; }
703-
704697
static bool classof(const Expr *E) {
705698
return E->getKind() == ExprKind::CodeCompletion;
706699
}

lib/Sema/CSGen.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,9 +1190,6 @@ namespace {
11901190
}
11911191

11921192
virtual Type visitCodeCompletionExpr(CodeCompletionExpr *E) {
1193-
if (!E->isActivated())
1194-
return Type();
1195-
11961193
CS.Options |= ConstraintSystemFlags::SuppressDiagnostics;
11971194
return CS.createTypeVariable(CS.getConstraintLocator(E),
11981195
TVO_CanBindToLValue);

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,9 +2231,6 @@ bool TypeChecker::typeCheckCompletionSequence(Expr *&expr, DeclContext *DC) {
22312231
// Ensure the output expression is up to date.
22322232
assert(exprAsBinOp == expr && isa<BinaryExpr>(expr) && "found wrong expr?");
22332233

2234-
// Add type variable for the code-completion expression.
2235-
CCE->setActivated();
2236-
22372234
if (auto generated = CS.generateConstraints(expr)) {
22382235
expr = generated;
22392236
} else {

test/IDE/complete_dynamic_lookup.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ func testAnyObject11_(_ dl: AnyObject) {
463463
dl.returnsObjcClass!(#^DL_FUNC_NAME_PAREN_1^#
464464
}
465465
// DL_FUNC_NAME_PAREN_1: Begin completions
466-
// DL_FUNC_NAME_PAREN_1-DAG: Pattern/CurrModule: ['(']{#Int#}[')'][#TopLevelObjcClass#]{{; name=.+$}}
466+
// DL_FUNC_NAME_PAREN_1-DAG: Pattern/CurrModule: ['(']{#(i): Int#}[')'][#TopLevelObjcClass#]{{; name=.+$}}
467467
// DL_FUNC_NAME_PAREN_1: End completions
468468

469469
func testAnyObject12(_ dl: AnyObject) {

0 commit comments

Comments
 (0)