Skip to content

Commit 8fd6d7e

Browse files
committed
Add some missing calls to setThrows
We no longer run error checking for already type-checked synthesized functions, so add a couple of `setThrows` calls where they were previously missing.
1 parent 9b8b206 commit 8fd6d7e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ deriveBodyEquatable_enum_noAssociatedValues_eq(AbstractFunctionDecl *eqDecl,
123123
AccessSemantics::Ordinary, fnType);
124124

125125
fnType = fnType->getResult()->castTo<FunctionType>();
126-
cmpFuncExpr = new (C) DotSyntaxCallExpr(ref, SourceLoc(), base, fnType);
127-
cmpFuncExpr->setImplicit();
126+
auto *callExpr = new (C) DotSyntaxCallExpr(ref, SourceLoc(), base, fnType);
127+
callExpr->setImplicit();
128+
callExpr->setThrows(false);
129+
cmpFuncExpr = callExpr;
128130
} else {
129131
cmpFuncExpr = new (C) DeclRefExpr(cmpFunc, DeclNameLoc(),
130132
/*implicit*/ true,
@@ -142,6 +144,7 @@ deriveBodyEquatable_enum_noAssociatedValues_eq(AbstractFunctionDecl *eqDecl,
142144
auto *cmpExpr = new (C) BinaryExpr(
143145
cmpFuncExpr, abTuple, /*implicit*/ true,
144146
fnType->castTo<FunctionType>()->getResult());
147+
cmpExpr->setThrows(false);
145148
statements.push_back(new (C) ReturnStmt(SourceLoc(), cmpExpr));
146149

147150
BraceStmt *body = BraceStmt::create(C, SourceLoc(), statements, SourceLoc());
@@ -839,6 +842,7 @@ deriveBodyHashable_hashValue(AbstractFunctionDecl *hashValueDecl, void *) {
839842
auto callExpr = CallExpr::createImplicit(C, hashExpr,
840843
{ selfRef }, { C.Id_for });
841844
callExpr->setType(hashFuncResultType);
845+
callExpr->setThrows(false);
842846

843847
auto returnStmt = new (C) ReturnStmt(SourceLoc(), callExpr);
844848

0 commit comments

Comments
 (0)