Commits

Slava Pestov committed 75bd88968bc
SILGen: Allow extensions to define designated initializers of generic types Previously, if a generic type had a stored property with a generic type and an initializer expression, we would emit the expression directly in the body of each designated initializer. This is a problem if the designated initializer is defined within an extension (even in the same source file), because extensions have a different set of generic parameters and archetypes. Also, we've had bugs in the past where emitting an expression multiple times didn't work properly. While these might currently all be fixed, this is a tricky case to test and it would be best to avoid it. Fix both problems by emitting the initializer expression inside its own function at the SIL level, and call the initializer function from each designated initializer. I'm using the existing 'variable initializer' mangling for this; it doesn't seem to be used for anything else right now. Currently, the default memberwise initializer does not use this, because the machinery for emitting it is somewhat duplicated and separate from the initializer expressions in user-defined constructors. I'll clean this up in an upcoming patch. Fixes <https://bugs.swift.org/browse/SR-488>.