@@ -4650,9 +4650,9 @@ static bool diagnoseImplicitSelfErrors(Expr *fnExpr, Expr *argExpr,
4650
4650
ConcreteDeclRef ref = nullptr ;
4651
4651
auto typeResult =
4652
4652
TC.getTypeOfExpressionWithoutApplying (el, CS.DC , ref);
4653
- if (!typeResult. hasValue () )
4653
+ if (!typeResult)
4654
4654
return false ;
4655
- elts.push_back (typeResult. getValue () );
4655
+ elts.push_back (typeResult);
4656
4656
}
4657
4657
4658
4658
argType = TupleType::get (elts, CS.getASTContext ());
@@ -6387,12 +6387,12 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) {
6387
6387
" unexpected declaration reference" );
6388
6388
6389
6389
ConcreteDeclRef decl = nullptr ;
6390
- Optional< Type> type = CS.TC .getTypeOfExpressionWithoutApplying (
6390
+ Type type = CS.TC .getTypeOfExpressionWithoutApplying (
6391
6391
fnExpr, CS.DC , decl, FreeTypeVariableBinding::UnresolvedType,
6392
6392
&listener);
6393
6393
6394
- if (type. hasValue () )
6395
- fnType = getFuncType (type. getValue () );
6394
+ if (type)
6395
+ fnType = getFuncType (type);
6396
6396
} else {
6397
6397
fnExpr = typeCheckChildIndependently (callExpr->getFn (), Type (),
6398
6398
CTP_CalleeResult, TCC_ForceRecheck,
@@ -7336,7 +7336,7 @@ bool FailureDiagnosis::diagnoseClosureExpr(
7336
7336
auto type = CS.TC .getTypeOfExpressionWithoutApplying (
7337
7337
closure, CS.DC , decl, FreeTypeVariableBinding::Disallow);
7338
7338
7339
- if (type && resultTypeProcessor (* type, expectedResultType))
7339
+ if (type && resultTypeProcessor (type, expectedResultType))
7340
7340
return true ;
7341
7341
}
7342
7342
@@ -7821,7 +7821,7 @@ bool FailureDiagnosis::visitKeyPathExpr(KeyPathExpr *KPE) {
7821
7821
&listener);
7822
7822
7823
7823
if (derivedType) {
7824
- if (auto *BGT = (* derivedType) ->getAs <BoundGenericClassType>()) {
7824
+ if (auto *BGT = derivedType->getAs <BoundGenericClassType>()) {
7825
7825
auto derivedValueType = BGT->getGenericArgs ().back ();
7826
7826
if (!CS.TC .isConvertibleTo (valueType, derivedValueType, CS.DC )) {
7827
7827
diagnose (KPE->getLoc (),
@@ -8982,7 +8982,7 @@ diagnoseAmbiguousMultiStatementClosure(ClosureExpr *closure) {
8982
8982
auto type = CS.TC .getTypeOfExpressionWithoutApplying (
8983
8983
resultExpr, CS.DC , decl, FreeTypeVariableBinding::UnresolvedType);
8984
8984
if (type)
8985
- resultType = type. getValue () ;
8985
+ resultType = type;
8986
8986
}
8987
8987
8988
8988
// If we found a type, presuppose it was the intended result and insert a
0 commit comments