Skip to content

[4.0] [ClangImporter] Structs lexically in an ObjC class are still top-level #10878

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

Merged
merged 1 commit into from
Jul 11, 2017

Conversation

jrose-apple
Copy link
Contributor

@jrose-apple jrose-apple commented Jul 11, 2017

  • Explanation: If a struct was declared lexically inside an Objective-C class (not even defined, just declared), it would erroneously be added to the class's list of members. This hit an assertion failure in +asserts builds and made the struct oddly accessible as a member of the class in no-asserts builds. Now we check the decl context to make sure that doesn't happen.
  • Scope: Only affects C declarations within Objective-C containers (classes, protocols, and categories).
  • Issue: rdar://problem/32451417
  • Reviewed by: @DougGregor
  • Risk: Low. This is technically a breaking change in non-asserts builds, because the struct really could be found via member lookup. But that should be considered a bug, and I suspect no one is relying on it.
  • Testing: Added new Swift regression tests, passed source compatibility suite on master.

…l. (swiftlang#10874)

Not every declaration that's syntactically in an Objective-C container
is a member of that container. Double-check the decl context before
adding it.

This is technically a breaking change in non-asserts builds, because
the struct really could be found via member lookup. But that should
be considered a bug, and I /suspect/ no one is relying on it.

rdar://problem/32451417
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

Also running some additional Apple-internal tests, so please don't eagerly merge even once the regular tests pass.

@jrose-apple jrose-apple merged commit 6c45caa into swiftlang:swift-4.0-branch Jul 11, 2017
@jrose-apple jrose-apple deleted the 4.0-level-up branch July 11, 2017 20:39
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