@@ -53,58 +53,6 @@ STATISTIC(TotalNumTypeVariables, "# of type variables created");
53
53
#include " ConstraintSolverStats.def"
54
54
STATISTIC (LargestSolutionAttemptNumber, " # of the largest solution attempt" );
55
55
56
- // / To aid code completion, we need to attempt to convert type holes
57
- // / back into underlying generic parameters if possible, since type
58
- // / of the code completion expression is used as "expected" (or contextual)
59
- // / type so it's helpful to know what requirements it has to filter
60
- // / the list of possible member candidates e.g.
61
- // /
62
- // / \code
63
- // / func test<T: P>(_: [T]) {}
64
- // /
65
- // / test(42.#^MEMBERS^#)
66
- // / \code
67
- // /
68
- // / It's impossible to resolve `T` in this case but code completion
69
- // / expression should still have a type of `[T]` instead of `[<<hole>>]`
70
- // / because it helps to produce correct contextual member list based on
71
- // / a conformance requirement associated with generic parameter `T`.
72
- // /
73
- // / \param cs The constraint system to retrieve type data from.
74
- // / \param typeVar The type variable associated with the code completion
75
- // / expression.
76
- // /
77
- // / \returns Completely resolved type, which could be used as "expected"
78
- // / type by code completion.
79
- static Type simplifyCodeCompletionType (ConstraintSystem &cs,
80
- TypeVariableType *typeVar) {
81
- auto completionTy = cs.getFixedType (typeVar);
82
- if (!completionTy)
83
- return Type ();
84
-
85
- auto resultTy = completionTy.transform ([&cs](Type type) -> Type {
86
- if (auto *typeVar = type->getAs <TypeVariableType>()) {
87
- auto fixedType = cs.getFixedType (typeVar);
88
- if (!fixedType->isHole ())
89
- return fixedType;
90
-
91
- if (auto *GP = typeVar->getImpl ().getGenericParameter ()) {
92
- // Code completion depends on generic parameter type being
93
- // represented in terms of `ArchetypeType` since it's easy
94
- // to extract protocol requirements from it.
95
- if (auto *GPD = GP->getDecl ())
96
- return GPD->getInnermostDeclContext ()->mapTypeIntoContext (GP);
97
- }
98
-
99
- return fixedType;
100
- }
101
-
102
- return type;
103
- });
104
-
105
- return cs.simplifyType (resultTy)->reconstituteSugar (false );
106
- }
107
-
108
56
TypeVariableType *ConstraintSystem::createTypeVariable (
109
57
ConstraintLocator *locator,
110
58
unsigned options) {
@@ -149,14 +97,6 @@ Solution ConstraintSystem::finalize() {
149
97
150
98
// For each of the type variables, get its fixed type.
151
99
for (auto tv : getTypeVariables ()) {
152
- if (shouldAttemptFixes ()) {
153
- auto *locator = tv->getImpl ().getLocator ();
154
- if (locator && locator->directlyAt <CodeCompletionExpr>()) {
155
- solution.typeBindings [tv] = simplifyCodeCompletionType (*this , tv);
156
- continue ;
157
- }
158
- }
159
-
160
100
solution.typeBindings [tv] = simplifyType (tv)->reconstituteSugar (false );
161
101
}
162
102
0 commit comments