@@ -783,16 +783,6 @@ namespace {
783
783
DeclContext *CurDC;
784
784
ConstraintSystemPhase CurrPhase;
785
785
786
- static const unsigned numEditorPlaceholderVariables = 2 ;
787
-
788
- // / A buffer of type variables used for editor placeholders. We only
789
- // / use a small number of these (rotating through), to prevent expressions
790
- // / with a large number of editor placeholders from flooding the constraint
791
- // / system with type variables.
792
- TypeVariableType *editorPlaceholderVariables[numEditorPlaceholderVariables]
793
- = { nullptr , nullptr };
794
- unsigned currentEditorPlaceholderVariable = 0 ;
795
-
796
786
// / A map from each UnresolvedMemberExpr to the respective (implicit) base
797
787
// / found during our walk.
798
788
llvm::MapVector<UnresolvedMemberExpr *, Type> UnresolvedBaseTypes;
@@ -3033,35 +3023,23 @@ namespace {
3033
3023
}
3034
3024
3035
3025
Type visitEditorPlaceholderExpr (EditorPlaceholderExpr *E) {
3026
+ auto *locator = CS.getConstraintLocator (E);
3027
+
3036
3028
if (auto *placeholderRepr = E->getPlaceholderTypeRepr ()) {
3037
3029
// Let's try to use specified type, if that's impossible,
3038
3030
// fallback to a type variable.
3039
3031
if (auto preferredTy = resolveTypeReferenceInExpression (
3040
- placeholderRepr, TypeResolverContext::InExpression,
3041
- CS.getConstraintLocator (E)))
3032
+ placeholderRepr, TypeResolverContext::InExpression, locator))
3042
3033
return preferredTy;
3043
3034
}
3044
3035
3045
- auto locator = CS.getConstraintLocator (E);
3046
-
3047
3036
// A placeholder may have any type, but default to Void type if
3048
3037
// otherwise unconstrained.
3049
- auto &placeholderTy
3050
- = editorPlaceholderVariables[currentEditorPlaceholderVariable];
3051
- if (!placeholderTy) {
3052
- placeholderTy = CS.createTypeVariable (locator, TVO_CanBindToNoEscape);
3053
-
3054
- CS.addConstraint (ConstraintKind::Defaultable,
3055
- placeholderTy,
3056
- TupleType::getEmpty (CS.getASTContext ()),
3057
- locator);
3058
- }
3038
+ auto *placeholderTy =
3039
+ CS.createTypeVariable (locator, TVO_CanBindToNoEscape);
3059
3040
3060
- // Move to the next placeholder variable.
3061
- // FIXME: Cycling type variables like this is unsound.
3062
- currentEditorPlaceholderVariable
3063
- = (currentEditorPlaceholderVariable + 1 ) %
3064
- numEditorPlaceholderVariables;
3041
+ CS.addConstraint (ConstraintKind::Defaultable, placeholderTy,
3042
+ TupleType::getEmpty (CS.getASTContext ()), locator);
3065
3043
3066
3044
return placeholderTy;
3067
3045
}
0 commit comments