Use operator bool to claw back some readability

This commit is contained in:
Robert Widmann
2019-10-29 16:25:43 -07:00
parent 37e82a6133
commit b849e51768
45 changed files with 120 additions and 156 deletions

View File

@@ -2288,7 +2288,7 @@ Type simplifyTypeImpl(ConstraintSystem &cs, Type type, Fn getFixedTypeFn) {
auto *proto = assocType->getProtocol();
auto conformance = cs.DC->getParentModule()->lookupConformance(
lookupBaseType, proto);
if (conformance.isInvalid())
if (!conformance)
return DependentMemberType::get(lookupBaseType, assocType);
auto subs = SubstitutionMap::getProtocolSubstitutions(
@@ -3079,9 +3079,8 @@ bool constraints::hasAppliedSelf(ConstraintSystem &cs,
bool constraints::conformsToKnownProtocol(ConstraintSystem &cs, Type type,
KnownProtocolKind protocol) {
if (auto *proto = cs.TC.getProtocol(SourceLoc(), protocol))
return !TypeChecker::conformsToProtocol(type, proto, cs.DC,
ConformanceCheckFlags::InExpression)
.isInvalid();
return (bool)TypeChecker::conformsToProtocol(
type, proto, cs.DC, ConformanceCheckFlags::InExpression);
return false;
}