Skip to content

Fix deserialization of lifetime dependencies on ast function types #81879

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

meg-gupta
Copy link
Contributor

While deserializing AST function types FunctionType and GenericFunctionType which include lifetime dependencies and an implicit self parameter, we don't correctly populate ASTExtInfoBuilder.lifetimeDependencies. We end up reading one dependency less due to incorrect index calculation.

Unlike SILFunctionType, AST function types FunctionType and GenericFunctionType do not include implicit self in their param list. They represent methods with implicit self as like: (Self) -> (Args...) -> Result and don't have any information to indicate they may have implicit self. Since we use number of parameters while deserializing lifetime dependencies, we go wrong for such function types.

Serialize the length of parameter indices, so that lifetime dependencies can be deserialized to that length.

rdar://151768216

@meg-gupta meg-gupta force-pushed the fixdeserialization branch 2 times, most recently from dfece87 to d82f6d9 Compare May 30, 2025 22:25
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta requested a review from atrick May 30, 2025 22:25
@meg-gupta meg-gupta marked this pull request as ready for review June 2, 2025 17:10
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@meg-gupta
Copy link
Contributor Author

@swift-ci test macOS platform

While deserializing AST function types FunctionType and GenericFunctionType which include
lifetime dependencies and an implicit self parameter, we don't correctly populate
ASTExtInfoBuilder.lifetimeDependencies.  We end up reading one dependency less due to
incorrect index calculation.

Unlike SILFunctionType, AST function types FunctionType and GenericFunctionType
do not include implicit self in their param list. They represent methods with
implicit self as like: `(Self) -> (Args...) -> Result` and don't have any information
to indicate they may have implicit self. Since we use number of parameters while
deserializing lifetime dependencies, we go wrong for such function types.

Serialize the length of parameter indices, so that lifetime dependencies can be
deserialized to that length.

rdar://151768216
@meg-gupta meg-gupta force-pushed the fixdeserialization branch from d82f6d9 to 36f3574 Compare June 3, 2025 00:32
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test Linux platform

@meg-gupta meg-gupta enabled auto-merge June 3, 2025 12:45
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