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

[ModuleInterface] Don't print property wrapper storage vars #26845

Conversation

harlanhaskins
Copy link
Collaborator

Previously, we would print the backing _val property for a given
property with a wrapper. This ended up printing incorrect output or
crashing when printing the initializer for these properties, because the
initializer consists of wholly-constructed calls to
MyWrapper.init(wrappedValue:). We don't need these storage vars, so just
omit them.

Fixes rdar://53555890 and rdar://53468607

Previously, we would print the backing _val property for a given
property with a wrapper. This ended up printing incorrect output or
crashing when printing the initializer for these properties, because the
initializer consists of wholly-constructed calls to
MyWrapper.init(wrappedValue:). We don't need these storage vars, so just
omit them.

Fixes rdar://53555890 and rdar://53468607
@@ -1485,7 +1485,7 @@ SourceRange PatternBindingEntry::getSourceRange(bool omitAccessors) const {
bool PatternBindingEntry::hasInitStringRepresentation() const {
if (InitContextAndIsText.getInt())
return !InitStringRepresentation.empty();
return getInit() && getInit()->getSourceRange().isValid();
return getOriginalInit() && getOriginalInit()->getSourceRange().isValid();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a related crash that was caused by #26416

@jrose-apple
Copy link
Contributor

Is it correct to print the $foo ones, though?

@jrose-apple
Copy link
Contributor

From offline conversation: it sounds like we'd be better off printing both than printing neither, but printing both is hard. I maintain that printing just one is worse than printing neither in principle, but in practice it will only affect frozen structs.

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