Skip to content

[4.2] [Clang importer] Allow us to wire up overrides with generic classes. #17706

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

DougGregor
Copy link
Member

Explanation: Imported generic Objective-C classes could end up importing initializers
that were not considered "overrides" of their superclass initializers, which could lead to ambiguities
due to initializers with the same signature being visible in multiple superclasses (e.g., UIViewController.init() and MyGenericObjCClass.init() would both exist but be ambiguous). Ensure that overrides are set up properly to address this Swift 4.2 regression.
Scope: Affects the initializers of imported generic Objective-C classes.
Risk: Low; this will add the "overrides" relationship among imported initializers for generic classes, but does not affect other relationships.
Testing: Compiler regression tests, include new tests.
Reviewer: @jrose-apple
SR / Radar: SR-8142 / rdar://problem/41591677

A use of "getAs<ClassType>()" when trying to wire up the overrides of
an imported Objective-C initializer meant that imported Objective-C
generic classes didn't get their overrides set properly. This could
lead to redundant initializers; use a proper accessor, since we only
need the ClassDecl anyway.

Fixes SR-8142 / rdar://problem/41591677.
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please nominate

@DougGregor DougGregor merged commit 23f70f7 into swiftlang:swift-4.2-branch Jul 3, 2018
@DougGregor DougGregor deleted the objc-init-generic-override-4.2 branch July 3, 2018 20:42
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