Skip to content

Commit 499844e

Browse files
authored
Merge pull request #37341 from ahoppen/pr/check-null-getresulttype
[AST] Return `null` type in `AbstractClosureExpr::getResultType` if `getType` is `null`
2 parents 4462691 + 1e8f4c1 commit 499844e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/AST/Expr.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,10 +1931,11 @@ void AbstractClosureExpr::setParameterList(ParameterList *P) {
19311931
Type AbstractClosureExpr::getResultType(
19321932
llvm::function_ref<Type(Expr *)> getType) const {
19331933
auto *E = const_cast<AbstractClosureExpr *>(this);
1934-
if (getType(E)->hasError())
1935-
return getType(E);
1934+
Type T = getType(E);
1935+
if (!T || T->hasError())
1936+
return T;
19361937

1937-
return getType(E)->castTo<FunctionType>()->getResult();
1938+
return T->castTo<FunctionType>()->getResult();
19381939
}
19391940

19401941
bool AbstractClosureExpr::isBodyThrowing() const {

0 commit comments

Comments
 (0)