Skip to content

ModuleInterface: Fix inheritance clauses in lazily emitted swiftinterfaces #68384

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

tshortli
Copy link
Contributor

@tshortli tshortli commented Sep 7, 2023

In lazy typechecking mode, nothing eagerly resolves the types in the inheritance clauses of declarations. This was causing swiftinterface printing to fail in a variety of ways. These fixes ensure inherited types are resolved on-demand by interface printing logic.

Builds on top of #68338.

Previously, a `.swiftinterface` emitted in lazy typechecking mode would fall
back on printing the `TypeRepr` of entries in the inheritance clause of a
declaration since inherited types could be unresolved.
Previously, `usesFeatureRethrowsProtocol()` could mistakenly return false in
lazy typechecking mode since the types in an inheritance clause might not have
been resolved yet.
Previously, conformances inherited through a base class could be missed in lazy
typechecking mode if types in the inheritance clause were not already resolved.
…ormances.

Previously, indirect public conformances provided by conforming to an internal
protocol could be skipped in a `.swiftinterface` in lazy typechecking mode
since inherited types might not be resolved before collecting the indirect
conformances.
… conformances.

Previously, unsatisfiable conformances could be omitted from emitted
`.swiftinterface` files in lazy typechecking mode since inherited types might
be unresolved when gathering the conformances.

Adding these test cases also revealed that serialization restrictions needed to
be relaxed in order to accomodate unsatisfiable conformances.
@tshortli
Copy link
Contributor Author

tshortli commented Sep 7, 2023

@swift-ci please test

@tshortli tshortli requested a review from xymus September 7, 2023 22:04
@tshortli tshortli merged commit e7d3250 into swiftlang:main Sep 8, 2023
@tshortli tshortli deleted the emit-module-lazy-typecheck-inherited-protocol-printing branch September 8, 2023 03:56
tshortli added a commit to tshortli/swift that referenced this pull request Sep 14, 2023
One of the request triggers added to `ConformanceLookupTable` in
swiftlang#68384 can cause circular request
evaluation. Revert the request trigger since it doesn't appear to be necessary
for the test cases introduced in that PR.

Resolves rdar://115314044
tshortli added a commit to tshortli/swift that referenced this pull request Sep 14, 2023
One of the request triggers added to `ConformanceLookupTable` in
swiftlang#68384 can cause circular request
evaluation. Revert the request trigger since it doesn't appear to be necessary
for the test cases introduced in that PR.

Resolves rdar://115314044
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.

2 participants