mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
BooleanType => Boolean
This commit is contained in:
committed by
Max Moiseev
parent
507b68315e
commit
2c95bb6d51
@@ -2532,9 +2532,9 @@ bool FailureDiagnosis::diagnoseGeneralConversionFailure(Constraint *constraint){
|
||||
}
|
||||
|
||||
if (auto PT = toType->getAs<ProtocolType>()) {
|
||||
// Check for "=" converting to BooleanType. The user probably meant ==.
|
||||
// Check for "=" converting to Boolean. The user probably meant ==.
|
||||
if (auto *AE = dyn_cast<AssignExpr>(expr->getValueProvidingExpr()))
|
||||
if (PT->getDecl()->isSpecificProtocol(KnownProtocolKind::BooleanType)) {
|
||||
if (PT->getDecl()->isSpecificProtocol(KnownProtocolKind::Boolean)) {
|
||||
diagnose(AE->getEqualLoc(), diag::use_of_equal_instead_of_equality)
|
||||
.fixItReplace(AE->getEqualLoc(), "==")
|
||||
.highlight(AE->getDest()->getLoc())
|
||||
@@ -4102,7 +4102,7 @@ bool FailureDiagnosis::visitIfExpr(IfExpr *IE) {
|
||||
auto falseExpr = typeCheckChildIndependently(IE->getElseExpr());
|
||||
if (!falseExpr) return true;
|
||||
|
||||
// Check for "=" converting to BooleanType. The user probably meant ==.
|
||||
// Check for "=" converting to Boolean. The user probably meant ==.
|
||||
if (auto *AE = dyn_cast<AssignExpr>(condExpr->getValueProvidingExpr())) {
|
||||
diagnose(AE->getEqualLoc(), diag::use_of_equal_instead_of_equality)
|
||||
.fixItReplace(AE->getEqualLoc(), "==")
|
||||
@@ -4113,7 +4113,7 @@ bool FailureDiagnosis::visitIfExpr(IfExpr *IE) {
|
||||
|
||||
// If the condition wasn't of boolean type, diagnose the problem.
|
||||
auto booleanType = CS->TC.getProtocol(IE->getQuestionLoc(),
|
||||
KnownProtocolKind::BooleanType);
|
||||
KnownProtocolKind::Boolean);
|
||||
if (!booleanType) return true;
|
||||
|
||||
if (!CS->TC.conformsToProtocol(condExpr->getType(), booleanType, CS->DC,
|
||||
|
||||
Reference in New Issue
Block a user