Skip to content

Diagnose usages of 'Self' in stored property initializers #25877

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

Conversation

slavapestov
Copy link
Contributor

Instead of walking stored property initializer expressions as part of computing the captures for a designated initializer, walk and store them separately. This makes more sense since SILGen emits them as separate functions.

Also, diagnose DynamicSelfType references inside stored property initializers, which are currently not supported.

Fixes rdar://problem/41490541, rdar://problem/51561208, https://bugs.swift.org/browse/SR-10969.

Store the captures for each stored property initializer separately,
instead of incorporating them into the capture list of each
designated initializer.

Fixes <rdar://problem/41490541>
…zers

A stored property initializer does not have access to either the
'self' instance or the 'Self' type, so SILGen would just crash
when emitting one containing a reference to 'Self'.

With some work on SILGen we could probably allow this, but for
now let's diagnose instead of crashing.

Fixes <rdar://problem/51561208>, <https://bugs.swift.org/browse/SR-10969>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

apple/swift-lldb#1757
@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

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.

1 participant