Skip to content

[ClangImporter] Redeclarations as Refinements #29561

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
Feb 4, 2020

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Jan 31, 2020

Add an algorithm to go search the override tables and the existing
loaded members of a class for a redeclaration point. The idea is that
both mirrored protocol members and categories offer a way to convince
the Clang Importer to import a property twice. We support a limited form
of this multiple-imports behavior today by allowing the redeclared
property to refine a readonly property into a readwrite property.

To maintain both the refinement behavior and to disambiguate any
remaining cases of ambiguity caused by extensions, attempt to identify
a redeclaration point if we can't identify an override point. Then,
decline to import the redeclared member if we're successful.

Note that the algorithm as presented is subject to import ordering. That
is, if a framework declares both an overlay and a clang module unit, if
the overlay is not loaded or members from the overlay are not installed
in the class by the time we see the declaration we may fail to identify
a redeclaration point.

@CodaFi CodaFi requested a review from slavapestov January 31, 2020 04:00
@CodaFi
Copy link
Contributor Author

CodaFi commented Jan 31, 2020

@swift-ci test

@CodaFi
Copy link
Contributor Author

CodaFi commented Jan 31, 2020

@swift-ci test source compatibility

@CodaFi CodaFi force-pushed the an-air-of-refinement branch 3 times, most recently from e14b9e7 to 9f3901f Compare February 3, 2020 20:23
@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 3, 2020

@swift-ci test

@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 3, 2020

@swift-ci test source compatibility

@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 4, 2020

Note to self: Stick rdar://59125907 into the commit message too.

@CodaFi CodaFi force-pushed the an-air-of-refinement branch from 9f3901f to 36e5bb6 Compare February 4, 2020 21:15
Add an algorithm to go search the override tables *and* the existing
loaded members of a class for a redeclaration point.  The idea is that
both mirrored protocol members and categories offer a way to convince
the Clang Importer to import a property twice. We support a limited form
of this multiple-imports behavior today by allowing the redeclared
property to refine a readonly property into a readwrite property.

To maintain both the refinement behavior and to disambiguate any
remaining cases of ambiguity caused by extensions, attempt to identify
a redeclaration point if we can't identify an override point. Then,
decline to import the redeclared member if we're successful.

Note that the algorithm as presented is subject to import ordering. That
is, if a framework declares both an overlay and a clang module unit, if
the overlay is not loaded or members from the overlay are not installed
in the class by the time we see the declaration we may fail to identify
an redeclaration point.

The regression tests are for rdar://59044692, rdar://59075988, and
rdar://59125907.
@CodaFi CodaFi force-pushed the an-air-of-refinement branch from 36e5bb6 to e825ca1 Compare February 4, 2020 21:15
@CodaFi CodaFi changed the title [ClangImporter][NOMERGE] Redeclarations as Refinements [ClangImporter] Redeclarations as Refinements Feb 4, 2020
@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 4, 2020

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Feb 4, 2020

⛵️

@CodaFi CodaFi merged commit c9b1723 into swiftlang:master Feb 4, 2020
@CodaFi CodaFi deleted the an-air-of-refinement branch February 4, 2020 23:24
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