Skip to content

Commit e52fd2a

Browse files
committed
[CS] NFC: Remove FreeTypeVariableBinding::UnresolvedType
This is now unused.
1 parent ba715db commit e52fd2a

File tree

3 files changed

+11
-30
lines changed

3 files changed

+11
-30
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ enum class FreeTypeVariableBinding {
102102
/// Disallow any binding of such free type variables.
103103
Disallow,
104104
/// Allow the free type variables to persist in the solution.
105-
Allow,
106-
/// Bind the type variables to UnresolvedType to represent the ambiguity.
107-
UnresolvedType
105+
Allow
108106
};
109107

110108
/// Describes whether or not a result builder method is supported.

lib/Sema/CSGen.cpp

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4872,29 +4872,16 @@ bool ConstraintSystem::generateConstraints(
48724872
return convertTypeLocator;
48734873
};
48744874

4875-
// Substitute type variables in for placeholder types (and unresolved
4876-
// types, if allowed).
4877-
if (allowFreeTypeVariables == FreeTypeVariableBinding::UnresolvedType) {
4878-
convertType = convertType.transformRec([&](Type type) -> std::optional<Type> {
4879-
if (type->is<UnresolvedType>() || type->is<PlaceholderType>()) {
4880-
return Type(createTypeVariable(getLocator(type),
4881-
TVO_CanBindToNoEscape |
4882-
TVO_PrefersSubtypeBinding |
4883-
TVO_CanBindToHole));
4884-
}
4885-
return std::nullopt;
4886-
});
4887-
} else {
4888-
convertType = convertType.transformRec([&](Type type) -> std::optional<Type> {
4889-
if (type->is<PlaceholderType>()) {
4890-
return Type(createTypeVariable(getLocator(type),
4891-
TVO_CanBindToNoEscape |
4892-
TVO_PrefersSubtypeBinding |
4893-
TVO_CanBindToHole));
4894-
}
4895-
return std::nullopt;
4896-
});
4897-
}
4875+
// Substitute type variables in for placeholder types.
4876+
convertType = convertType.transformRec([&](Type type) -> std::optional<Type> {
4877+
if (type->is<PlaceholderType>()) {
4878+
return Type(createTypeVariable(getLocator(type),
4879+
TVO_CanBindToNoEscape |
4880+
TVO_PrefersSubtypeBinding |
4881+
TVO_CanBindToHole));
4882+
}
4883+
return std::nullopt;
4884+
});
48984885

48994886
addContextualConversionConstraint(expr, convertType, ctp,
49004887
convertTypeLocator);

lib/Sema/CSSolver.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ Solution ConstraintSystem::finalize() {
9191

9292
case FreeTypeVariableBinding::Allow:
9393
break;
94-
95-
case FreeTypeVariableBinding::UnresolvedType:
96-
assignFixedType(tv, ctx.TheUnresolvedType);
97-
break;
9894
}
9995
}
10096

0 commit comments

Comments
 (0)