Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix store to generic member from extension #3949

Merged

Conversation

slavapestov
Copy link
Member

@slavapestov slavapestov commented Aug 3, 2016

rdar://problem/21473547

@slavapestov
Copy link
Member Author

@swift-ci Please smoke test

… 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>.
@slavapestov slavapestov force-pushed the fix-store-generic-member-from-extension branch from 9008e02 to 75bd889 Compare August 3, 2016 08:03
@slavapestov
Copy link
Member Author

@swift-ci Please smoke test and merge

@swift-ci swift-ci merged commit 40d1adc into apple:master Aug 3, 2016
@slavapestov slavapestov deleted the fix-store-generic-member-from-extension branch August 19, 2016 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants