Skip to content

Commit fdb42fe

Browse files
committed
Sema: Fix weird logic in TypeChecker::addImplicitConstructors()
1 parent 6f8fd07 commit fdb42fe

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/Sema/CodeSynthesis.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,6 @@ static void addImplicitInheritedConstructorsToClass(ClassDecl *decl) {
10221022
return;
10231023
}
10241024

1025-
decl->setAddedImplicitInitializers();
1026-
10271025
// We can only inherit initializers if we have a superclass.
10281026
if (!decl->getSuperclassDecl() || !decl->getSuperclass())
10291027
return;
@@ -1166,10 +1164,10 @@ void TypeChecker::addImplicitConstructors(NominalTypeDecl *decl) {
11661164
if (decl->addedImplicitInitializers())
11671165
return;
11681166

1169-
if (!shouldAttemptInitializerSynthesis(decl)) {
1170-
decl->setAddedImplicitInitializers();
1167+
decl->setAddedImplicitInitializers();
1168+
1169+
if (!shouldAttemptInitializerSynthesis(decl))
11711170
return;
1172-
}
11731171

11741172
if (auto *classDecl = dyn_cast<ClassDecl>(decl)) {
11751173
addImplicitInheritedConstructorsToClass(classDecl);

0 commit comments

Comments
 (0)