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