Skip to content

Commit 6ce4be9

Browse files
authored
Merge pull request #5261 from DougGregor/type-checker-extra-constraints
[Type checker] Eliminate generation of useless constraints NFC.
2 parents 401d3cc + 735ef83 commit 6ce4be9

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,12 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
33133313
}
33143314
}
33153315

3316+
// If the right-hand side and result type are both type parameters, we're
3317+
// not providing a useful completion.
3318+
if (expr->getType()->isTypeParameter() &&
3319+
CCE.getType()->isTypeParameter())
3320+
return;
3321+
33163322
addInfixOperatorCompletion(op, expr->getType(), CCE.getType());
33173323
}
33183324
}

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -468,25 +468,6 @@ namespace {
468468
FunctionRefKind::Compound,
469469
locator));
470470

471-
if (!archetype) {
472-
// If the nested type is not an archetype (because it was constrained
473-
// to a concrete type by a requirement), return the fresh type
474-
// variable now, and let binding occur during overload resolution.
475-
return memberTypeVar;
476-
}
477-
478-
// FIXME: Would be better to walk the requirements of the protocol
479-
// of which the associated type is a member.
480-
if (auto superclass = member->getSuperclass()) {
481-
CS.addConstraint(ConstraintKind::Subtype, memberTypeVar,
482-
superclass, locator);
483-
}
484-
485-
for (auto proto : member->getConformingProtocols()) {
486-
CS.addConstraint(ConstraintKind::ConformsTo, memberTypeVar,
487-
proto->getDeclaredType(), locator);
488-
}
489-
490471
return memberTypeVar;
491472
});
492473
}

0 commit comments

Comments
 (0)