Skip to content

[6.1] [Serialization] Ensure we run InheritedTypeRequest before serializing inherited type #78956

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 5, 2025

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 27, 2025

  • Explanation: When using -experimental-skip-all-function-bodies we don’t run the TypeCheckSourceFileRequest and thus don’t go through the decl checker, which calls InheritedTypeRequest on all inheritance clauses. This means that the inherited entries are not populated by the time we serialize the module and null types are serialized into a module created with these options, which happens during background preparation from SourceKit-LSP. Trigger the computation of inherited entries by calling InheritedTypeRequest during serialization.
  • Scope: Module serialization
  • Issue: rdar://141440011
  • Original PR: [Serialization] Ensure we run InheritedTypeRequest before serializing inherited type #78899
  • Risk: Low, invoking the InheritedTypeRequest should have no effect if it already ran and otherwise we were serializing an incorrect null type
  • Testing: Added regression test
  • Reviewer: @hamishknight

…ng inherited type

When using `-experimental-skip-all-function-bodies` we don’t run the `TypeCheckSourceFileRequest` and thus don’t go through the decl checker, which calls `InheritedTypeRequest` on all inheritance clauses. This means that the inherited entries are not populated by the time we serialize the module. Trigger the computation of inherited entries by calling `InheritedTypeRequest` during serialization.

Unfortunately, we can’t use the type returned by `getResolvedType` for the serialization because `getResolvedType` returns an inverted protocol type for suppressed conformances but during serialization, we want to serialize the suppressed type with a `isSuppressedBit`. We thus need to call `getEntry(i).getType()` again to get the type to serialize.

rdar://141440011
@ahoppen ahoppen requested a review from a team as a code owner January 27, 2025 20:43
@ahoppen
Copy link
Member Author

ahoppen commented Jan 27, 2025

@swift-ci Please test

@ahoppen ahoppen merged commit 3fa61e3 into swiftlang:release/6.1 Feb 5, 2025
5 checks passed
@ahoppen ahoppen deleted the 6.1/rdar141440011 branch February 5, 2025 02:37
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