Skip to content

Commit 4c23207

Browse files
author
Itai Ferber
committed
Fix init(from:) required condition
1 parent bdfa927 commit 4c23207

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/DerivedConformanceCodable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ static ValueDecl *deriveDecodable_init(TypeChecker &tc, Decl *parentDecl,
887887
initDecl->setBodySynthesizer(deriveBodyDecodable_init);
888888

889889
// This constructor should be marked as `required` for non-final classes.
890-
if (isa<ClassDecl>(type) && type->getAttrs().hasAttribute<FinalAttr>()) {
890+
if (isa<ClassDecl>(type) && !type->getAttrs().hasAttribute<FinalAttr>()) {
891891
auto *reqAttr = new (C) SimpleDeclAttr<DAK_Required>(/*IsImplicit=*/true);
892892
initDecl->getAttrs().add(reqAttr);
893893
}

0 commit comments

Comments
 (0)