Skip to content

Commit cc507fc

Browse files
committed
[CS] NFC: Rename VarRefCollector -> TypeVarRefCollector
1 parent 9c7639d commit cc507fc

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6238,18 +6238,22 @@ class ConjunctionElementProducer : public BindingProducer<ConjunctionElement> {
62386238
}
62396239
};
62406240

6241-
/// Find any references to not yet resolved outer VarDecls (including closure
6242-
/// parameters) used in the body of a conjunction element (e.g closures, taps,
6243-
/// if/switch expressions). This is required because isolated conjunctions, just
6244-
/// like single-expression closures, have to be connected to type variables they
6245-
/// are going to use, otherwise they'll get placed in a separate solver
6246-
/// component and would never produce a solution.
6247-
class VarRefCollector : public ASTWalker {
6241+
/// Find any references to external type variables used in the body of a
6242+
/// conjunction element (e.g closures, taps, if/switch expressions).
6243+
///
6244+
/// This includes:
6245+
/// - Not yet resolved outer VarDecls (including closure parameters)
6246+
///
6247+
/// This is required because isolated conjunctions, just like single-expression
6248+
/// closures, have to be connected to type variables they are going to use,
6249+
/// otherwise they'll get placed in a separate solver component and would never
6250+
/// produce a solution.
6251+
class TypeVarRefCollector : public ASTWalker {
62486252
ConstraintSystem &CS;
62496253
llvm::SmallSetVector<TypeVariableType *, 4> TypeVars;
62506254

62516255
public:
6252-
VarRefCollector(ConstraintSystem &cs) : CS(cs) {}
6256+
TypeVarRefCollector(ConstraintSystem &cs) : CS(cs) {}
62536257

62546258
/// Infer the referenced type variables from a given decl.
62556259
void inferTypeVars(Decl *D);

lib/Sema/CSGen.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ namespace {
866866
};
867867
} // end anonymous namespace
868868

869-
void VarRefCollector::inferTypeVars(Decl *D) {
869+
void TypeVarRefCollector::inferTypeVars(Decl *D) {
870870
// We're only interested in VarDecls.
871871
if (!isa_and_nonnull<VarDecl>(D))
872872
return;
@@ -881,7 +881,7 @@ void VarRefCollector::inferTypeVars(Decl *D) {
881881
}
882882

883883
ASTWalker::PreWalkResult<Expr *>
884-
VarRefCollector::walkToExprPre(Expr *expr) {
884+
TypeVarRefCollector::walkToExprPre(Expr *expr) {
885885
if (auto *DRE = dyn_cast<DeclRefExpr>(expr))
886886
inferTypeVars(DRE->getDecl());
887887

@@ -1304,7 +1304,7 @@ namespace {
13041304
// in the tap body, otherwise tap expression is going
13051305
// to get disconnected from the context.
13061306
if (auto *body = tap->getBody()) {
1307-
VarRefCollector refCollector(CS);
1307+
TypeVarRefCollector refCollector(CS);
13081308

13091309
body->walk(refCollector);
13101310

@@ -2938,7 +2938,7 @@ namespace {
29382938
auto *locator = CS.getConstraintLocator(closure);
29392939
auto closureType = CS.createTypeVariable(locator, TVO_CanBindToNoEscape);
29402940

2941-
VarRefCollector refCollector(CS);
2941+
TypeVarRefCollector refCollector(CS);
29422942
// Walk the capture list if this closure has one, because it could
29432943
// reference declarations from the outer closure.
29442944
if (auto *captureList =

lib/Sema/CSSyntacticElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static void createConjunction(ConstraintSystem &cs,
335335
isIsolated = true;
336336
}
337337

338-
VarRefCollector paramCollector(cs);
338+
TypeVarRefCollector paramCollector(cs);
339339

340340
// Whether we're doing completion, and the conjunction is for a
341341
// SingleValueStmtExpr, or one of its braces.

0 commit comments

Comments
 (0)