@@ -4922,6 +4922,8 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
4922
4922
ConstraintKind matchKind,
4923
4923
TypeMatchOptions flags,
4924
4924
ConstraintLocatorBuilder locator) {
4925
+ assert (!type1->isTypeVariableOrMember () && !type2->isTypeVariableOrMember ());
4926
+
4925
4927
// Add to the score based on context.
4926
4928
auto addContextualScore = [&] {
4927
4929
// Okay, we need to perform one or more conversions. If this
@@ -4933,20 +4935,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
4933
4935
}
4934
4936
};
4935
4937
4936
- // Local function to form an unsolved result.
4937
- auto formUnsolved = [&] {
4938
- if (flags.contains (TMF_GenerateConstraints)) {
4939
- addUnsolvedConstraint (
4940
- Constraint::createRestricted (
4941
- *this , matchKind, restriction, type1, type2,
4942
- getConstraintLocator (locator)));
4943
-
4944
- return SolutionKind::Solved;
4945
- }
4946
-
4947
- return SolutionKind::Unsolved;
4948
- };
4949
-
4950
4938
TypeMatchOptions subflags = getDefaultDecompositionOptions (flags);
4951
4939
4952
4940
switch (restriction) {
@@ -5019,9 +5007,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
5019
5007
increaseScore (SK_ValueToOptional);
5020
5008
5021
5009
assert (matchKind >= ConstraintKind::Subtype);
5022
- if (type2->isTypeVariableOrMember ())
5023
- return formUnsolved ();
5024
-
5025
5010
if (auto generic2 = type2->getAs <BoundGenericType>()) {
5026
5011
if (generic2->getDecl ()->isOptionalDecl ()) {
5027
5012
return matchTypes (type1, generic2->getGenericArgs ()[0 ],
@@ -5043,9 +5028,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
5043
5028
case ConversionRestrictionKind::OptionalToOptional: {
5044
5029
addContextualScore ();
5045
5030
5046
- if (type1->isTypeVariableOrMember () || type2->isTypeVariableOrMember ())
5047
- return formUnsolved ();
5048
-
5049
5031
assert (matchKind >= ConstraintKind::Subtype);
5050
5032
if (auto generic1 = type1->getAs <BoundGenericType>()) {
5051
5033
if (auto generic2 = type2->getAs <BoundGenericType>()) {
0 commit comments