Skip to content

Commit 7ca5abd

Browse files
committed
Ensure we have type-checked _hashValue(for:) before we use it.
Otherwise, the standard library won't build ;)
1 parent 02d6075 commit 7ca5abd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,9 @@ deriveBodyHashable_hashValue(AbstractFunctionDecl *hashValueDecl, void *) {
11711171

11721172
// _hashValue(for:)
11731173
auto *hashFunc = C.getHashValueForDecl();
1174+
if (!hashFunc->hasInterfaceType())
1175+
static_cast<TypeChecker *>(C.getLazyResolver())->validateDecl(hashFunc);
1176+
11741177
auto substitutions = SubstitutionMap::get(
11751178
hashFunc->getGenericSignature(),
11761179
[&](SubstitutableType *dependentType) {
@@ -1184,7 +1187,6 @@ deriveBodyHashable_hashValue(AbstractFunctionDecl *hashValueDecl, void *) {
11841187
LookUpConformanceInModule(hashValueDecl->getModuleContext()));
11851188
ConcreteDeclRef hashFuncRef(hashFunc, substitutions);
11861189

1187-
11881190
Type hashFuncType = hashFunc->getInterfaceType().subst(substitutions);
11891191
auto hashExpr = new (C) DeclRefExpr(hashFuncRef, DeclNameLoc(),
11901192
/*implicit*/ true,

0 commit comments

Comments
 (0)