@@ -865,7 +865,9 @@ ConstraintSystem::getPotentialBindingForRelationalConstraint(
865
865
866
866
// If the type we'd be binding to is a dependent member, don't try to
867
867
// resolve this type variable yet.
868
- if (type->is <DependentMemberType>()) {
868
+ if (type->getWithoutSpecifierType ()
869
+ ->lookThroughAllOptionalTypes ()
870
+ ->is <DependentMemberType>()) {
869
871
SmallVector<TypeVariableType *, 4 > referencedVars;
870
872
type->getTypeVariables (referencedVars);
871
873
@@ -1210,15 +1212,19 @@ Optional<Type> ConstraintSystem::checkTypeOfBinding(TypeVariableType *typeVar,
1210
1212
}
1211
1213
}
1212
1214
1213
- // If the type is a type variable itself, don't permit the binding.
1214
- if (type->getRValueType ()->is <TypeVariableType>())
1215
- return None;
1215
+ {
1216
+ auto objType = type->getWithoutSpecifierType ();
1216
1217
1217
- // Don't bind to a dependent member type, even if it's currently
1218
- // wrapped in any number of optionals, because binding producer
1219
- // might unwrap and try to attempt it directly later.
1220
- if (type->lookThroughAllOptionalTypes ()->is <DependentMemberType>())
1221
- return None;
1218
+ // If the type is a type variable itself, don't permit the binding.
1219
+ if (objType->is <TypeVariableType>())
1220
+ return None;
1221
+
1222
+ // Don't bind to a dependent member type, even if it's currently
1223
+ // wrapped in any number of optionals, because binding producer
1224
+ // might unwrap and try to attempt it directly later.
1225
+ if (objType->lookThroughAllOptionalTypes ()->is <DependentMemberType>())
1226
+ return None;
1227
+ }
1222
1228
1223
1229
// Okay, allow the binding (with the simplified type).
1224
1230
return type;
0 commit comments