Decide if a class inherits convenience inits alongside implicit inits

We have a predicate in ClassDecl, 'inheritsSuperclassInitializers',
that is used in a few places to decide if we need to do lookups into a
superclass to find all relevant initializers. That's useful, but the
actual work being computed in that function is almost identical to the
work done in figuring out whether the class has provided all its
superclass's /required/ initializers, which is part of the type
checker operation 'resolveImplicitConstructors'. Furthermore,
'inheritsSuperclassInitializers' is /already/ calling
'resolveImplicitConstructors' because those implicit constructors
might affect the result.

Simplify this whole mess and prevent further inconsistencies like the
previous commit by just making 'resolveImplicitConstructors' decide
whether superclass convenience initializers are inherited. It does
make that function more complicated, but with the benefit of not
having duplication anymore.

No intended user-visible change, except that this bit is now
serialized instead of being recomputed, which means the module format
changed.
This commit is contained in:
Jordan Rose
2018-03-19 18:27:27 -07:00
parent a19cf7b183
commit 8a66d998fa
8 changed files with 173 additions and 173 deletions

View File

@@ -55,7 +55,7 @@ const uint16_t VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t VERSION_MINOR = 403; // Last change: `init` special name
const uint16_t VERSION_MINOR = 404; // Last change: inheritsSuperclassInitializers
using DeclIDField = BCFixed<31>;
@@ -887,7 +887,8 @@ namespace decls_block {
DeclContextIDField,// context decl
BCFixed<1>, // implicit?
BCFixed<1>, // explicitly objc?
BCFixed<1>, // requires stored property initial values
BCFixed<1>, // requires stored property initial values?
BCFixed<1>, // inherits convenience initializers from its superclass?
GenericEnvironmentIDField, // generic environment
TypeIDField, // superclass
AccessLevelField, // access level