@@ -1256,9 +1256,11 @@ AccessLevel ExtensionDecl::getMaxAccessLevel() const {
1256
1256
1257
1257
Type ExtensionDecl::getExtendedType () const {
1258
1258
ASTContext &ctx = getASTContext ();
1259
- return evaluateOrDefault (ctx.evaluator ,
1260
- ExtendedTypeRequest{const_cast <ExtensionDecl *>(this )},
1261
- ErrorType::get (ctx));
1259
+ if (auto type = evaluateOrDefault (ctx.evaluator ,
1260
+ ExtendedTypeRequest{const_cast <ExtensionDecl *>(this )},
1261
+ Type ()))
1262
+ return type;
1263
+ return ErrorType::get (ctx);
1262
1264
}
1263
1265
1264
1266
// / Clone the given generic parameters in the given list. We don't need any
@@ -2881,19 +2883,21 @@ bool ValueDecl::isRecursiveValidation() const {
2881
2883
}
2882
2884
2883
2885
Type ValueDecl::getInterfaceType () const {
2886
+ auto &ctx = getASTContext ();
2887
+
2884
2888
// Our clients that don't register the lazy resolver are relying on the
2885
2889
// fact that they can't pull an interface type out to avoid doing work.
2886
2890
// This is a necessary evil until we can wean them off.
2887
- if (!getASTContext () .getLazyResolver ()) {
2891
+ if (!ctx .getLazyResolver ()) {
2888
2892
return TypeAndAccess.getPointer ();
2889
2893
}
2890
2894
2891
- if (auto Ty =
2892
- evaluateOrDefault (getASTContext () .evaluator ,
2895
+ if (auto type =
2896
+ evaluateOrDefault (ctx .evaluator ,
2893
2897
InterfaceTypeRequest{const_cast <ValueDecl *>(this )},
2894
- ErrorType::get ( getASTContext () )))
2895
- return Ty ;
2896
- return ErrorType::get (getASTContext () );
2898
+ Type ( )))
2899
+ return type ;
2900
+ return ErrorType::get (ctx );
2897
2901
}
2898
2902
2899
2903
void ValueDecl::setInterfaceType (Type type) {
@@ -3695,9 +3699,11 @@ SourceRange TypeAliasDecl::getSourceRange() const {
3695
3699
3696
3700
Type TypeAliasDecl::getUnderlyingType () const {
3697
3701
auto &ctx = getASTContext ();
3698
- return evaluateOrDefault (ctx.evaluator ,
3702
+ if ( auto type = evaluateOrDefault (ctx.evaluator ,
3699
3703
UnderlyingTypeRequest{const_cast <TypeAliasDecl *>(this )},
3700
- ErrorType::get (ctx));
3704
+ Type ()))
3705
+ return type;
3706
+ return ErrorType::get (ctx);
3701
3707
}
3702
3708
3703
3709
void TypeAliasDecl::setUnderlyingType (Type underlying) {
@@ -3728,10 +3734,12 @@ UnboundGenericType *TypeAliasDecl::getUnboundGenericType() const {
3728
3734
3729
3735
Type TypeAliasDecl::getStructuralType () const {
3730
3736
auto &ctx = getASTContext ();
3731
- return evaluateOrDefault (
3737
+ if ( auto type = evaluateOrDefault (
3732
3738
ctx.evaluator ,
3733
3739
StructuralTypeRequest{const_cast <TypeAliasDecl *>(this )},
3734
- ErrorType::get (ctx));
3740
+ Type ()))
3741
+ return type;
3742
+ return ErrorType::get (ctx);
3735
3743
}
3736
3744
3737
3745
Type AbstractTypeParamDecl::getSuperclass () const {
@@ -6313,9 +6321,11 @@ void SubscriptDecl::setIndices(ParameterList *p) {
6313
6321
Type SubscriptDecl::getElementInterfaceType () const {
6314
6322
auto &ctx = getASTContext ();
6315
6323
auto mutableThis = const_cast <SubscriptDecl *>(this );
6316
- return evaluateOrDefault (ctx.evaluator ,
6324
+ if ( auto type = evaluateOrDefault (ctx.evaluator ,
6317
6325
ResultTypeRequest{mutableThis},
6318
- ErrorType::get (ctx));
6326
+ Type ()))
6327
+ return type;
6328
+ return ErrorType::get (ctx);
6319
6329
}
6320
6330
6321
6331
ObjCSubscriptKind SubscriptDecl::getObjCSubscriptKind () const {
@@ -6943,9 +6953,11 @@ StaticSpellingKind FuncDecl::getCorrectStaticSpelling() const {
6943
6953
Type FuncDecl::getResultInterfaceType () const {
6944
6954
auto &ctx = getASTContext ();
6945
6955
auto mutableThis = const_cast <FuncDecl *>(this );
6946
- return evaluateOrDefault (ctx.evaluator ,
6956
+ if ( auto type = evaluateOrDefault (ctx.evaluator ,
6947
6957
ResultTypeRequest{mutableThis},
6948
- ErrorType::get (ctx));
6958
+ Type ()))
6959
+ return type;
6960
+ return ErrorType::get (ctx);
6949
6961
}
6950
6962
6951
6963
bool FuncDecl::isUnaryOperator () const {
0 commit comments