@@ -2496,7 +2496,7 @@ static bool tryRawRepresentableFixIts(InFlightDiagnostic &diag,
2496
2496
const Expr *expr) {
2497
2497
// The following fixes apply for optional destination types as well.
2498
2498
bool toTypeIsOptional = !toType->getOptionalObjectType().isNull();
2499
- toType = toType->lookThroughAllAnyOptionalTypes ();
2499
+ toType = toType->lookThroughAllOptionalTypes ();
2500
2500
2501
2501
Type fromTypeUnwrapped = fromType->getOptionalObjectType();
2502
2502
bool fromTypeIsOptional = !fromTypeUnwrapped.isNull();
@@ -2697,7 +2697,7 @@ static bool addTypeCoerceFixit(InFlightDiagnostic &diag, ConstraintSystem &CS,
2697
2697
Type fromType, Type toType, Expr *expr) {
2698
2698
// Look through optional types; casts can add them, but can't remove extra
2699
2699
// ones.
2700
- toType = toType->lookThroughAllAnyOptionalTypes ();
2700
+ toType = toType->lookThroughAllOptionalTypes ();
2701
2701
2702
2702
CheckedCastKind Kind = CS.getTypeChecker().typeCheckCheckedCast(
2703
2703
fromType, toType, CheckedCastContextKind::None, CS.DC, SourceLoc(),
@@ -2736,7 +2736,7 @@ static bool tryDiagnoseNonEscapingParameterToEscaping(
2736
2736
// the event of an implicit promotion.
2737
2737
auto srcFT = srcType->getAs<AnyFunctionType>();
2738
2738
auto dstFT =
2739
- dstType->lookThroughAllAnyOptionalTypes ()->getAs<AnyFunctionType>();
2739
+ dstType->lookThroughAllOptionalTypes ()->getAs<AnyFunctionType>();
2740
2740
2741
2741
if (!srcFT || !dstFT || !srcFT->isNoEscape() || dstFT->isNoEscape())
2742
2742
return false;
@@ -4294,7 +4294,7 @@ diagnoseSingleCandidateFailures(CalleeCandidateInfo &CCI, Expr *fnExpr,
4294
4294
isa<ConstructorDecl>(candidate.getDecl()) && candidate.level == 1) {
4295
4295
AnyFunctionType::Param &arg = args[0];
4296
4296
auto resTy =
4297
- candidate.getResultType()->lookThroughAllAnyOptionalTypes ();
4297
+ candidate.getResultType()->lookThroughAllOptionalTypes ();
4298
4298
auto rawTy = isRawRepresentable(resTy, CCI.CS);
4299
4299
if (rawTy && arg.getType() && resTy->isEqual(arg.getType())) {
4300
4300
auto getInnerExpr = [](Expr *E) -> Expr * {
@@ -4338,8 +4338,8 @@ diagnoseSingleCandidateFailures(CalleeCandidateInfo &CCI, Expr *fnExpr,
4338
4338
static bool isRawRepresentableMismatch(Type fromType, Type toType,
4339
4339
KnownProtocolKind kind,
4340
4340
const ConstraintSystem &CS) {
4341
- toType = toType->lookThroughAllAnyOptionalTypes ();
4342
- fromType = fromType->lookThroughAllAnyOptionalTypes ();
4341
+ toType = toType->lookThroughAllOptionalTypes ();
4342
+ fromType = fromType->lookThroughAllOptionalTypes ();
4343
4343
4344
4344
// First check if this is an attempt to convert from something to
4345
4345
// raw representable.
@@ -6636,7 +6636,7 @@ static bool diagnoseKeyPathComponents(ConstraintSystem &CS, KeyPathExpr *KPE,
6636
6636
Type currentType = rootType;
6637
6637
auto updateState = [&](bool isProperty, Type newType) {
6638
6638
// Strip off optionals.
6639
- newType = newType->lookThroughAllAnyOptionalTypes ();
6639
+ newType = newType->lookThroughAllOptionalTypes ();
6640
6640
6641
6641
// If updating to a type, just set the new type; there's nothing
6642
6642
// more to do.
@@ -7027,7 +7027,7 @@ bool FailureDiagnosis::visitArrayExpr(ArrayExpr *E) {
7027
7027
7028
7028
// If our contextual type is an optional, look through them, because we're
7029
7029
// surely initializing whatever is inside.
7030
- contextualType = contextualType->lookThroughAllAnyOptionalTypes ();
7030
+ contextualType = contextualType->lookThroughAllOptionalTypes ();
7031
7031
7032
7032
// Validate that the contextual type conforms to ExpressibleByArrayLiteral and
7033
7033
// figure out what the contextual element type is in place.
@@ -7115,7 +7115,7 @@ bool FailureDiagnosis::visitDictionaryExpr(DictionaryExpr *E) {
7115
7115
if (auto contextualType = CS.getContextualType()) {
7116
7116
// If our contextual type is an optional, look through them, because we're
7117
7117
// surely initializing whatever is inside.
7118
- contextualType = contextualType->lookThroughAllAnyOptionalTypes ();
7118
+ contextualType = contextualType->lookThroughAllOptionalTypes ();
7119
7119
7120
7120
auto DLC = CS.TC.getProtocol(
7121
7121
E->getLoc(), KnownProtocolKind::ExpressibleByDictionaryLiteral);
0 commit comments