Skip to content

Commit 05601da

Browse files
committed
[SQUASH ME] Follow recent changes in code synthesis
1 parent 03b3f58 commit 05601da

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

lib/Sema/DerivedConformanceEquatableHashable.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -823,21 +823,10 @@ deriveHashable_hashInto(TypeChecker &tc, Decl *parentDecl,
823823
FunctionType::ExtInfo());
824824
}
825825
hashDecl->setInterfaceType(interfaceType);
826-
hashDecl->copyFormalAccessAndVersionedAttrFrom(typeDecl);
826+
hashDecl->copyFormalAccessFrom(typeDecl);
827+
hashDecl->setValidationStarted();
827828

828-
// If we aren't synthesizing into an imported/derived type, the derived conformance is
829-
// either from the type itself or an extension, in which case we will emit the
830-
// declaration normally.
831-
//
832-
// We're checking for a source file here rather than the presence of a Clang
833-
// node because otherwise we wouldn't catch synthesized Hashable structs, like
834-
// SE-0112's imported Error types.
835-
if (!isa<SourceFile>(parentDC->getModuleScopeContext())) {
836-
C.addExternalDecl(hashDecl);
837-
// Assume the new function is already typechecked; TypeChecker::validateDecl
838-
// would otherwise reject it.
839-
hashDecl->setValidationStarted();
840-
}
829+
C.addSynthesizedDecl(hashDecl);
841830

842831
cast<IterableDeclContext>(parentDecl)->addMember(hashDecl);
843832
return hashDecl;

0 commit comments

Comments
 (0)