Skip to content

[5.5][SourceKit] Don’t transform type when printing if CurrentType can’t have members #37079

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Apr 27, 2021

Since 9ba892c we always transform CurrentType in ASTPrinter to be an interface type.

This causes issues when the variable type is a generic parameter type. Previously we had CurrentType set to a PrimaryArchetypeType. With the fix in d93ae06, we are mapping the archetype out of context to a GenericParamType. A GenericParamType, however, can’t have members, so we’re hitting an assertion when creating a TypeTransformContext. Since the entire type transformation in printTransformedTypeWithOptions is only affecting type members, we should be able to safely skip over the transformation if CurrentType can’t have any members.

Cherry-picks #36989

…ave members

Since 9ba892c we always transform `CurrentType` in `ASTPrinter` to be an interface type.

This causes issues when the variable type is a generic parameter type. Previously we had `CurrentType` set to a `PrimaryArchetypeType`. With the fix in d93ae06, we are mapping the archetype out of context to a `GenericParamType`. A `GenericParamType`, however, can’t have members, so we’re hitting an assertion when creating a `TypeTransformContext`. Since the entire type transformation in `printTransformedTypeWithOptions` is only affecting type members, we should be able to safely skip over the transformation if `CurrentType` can’t have any members.

Fixes rdar://76750555 [SR-14497]
@ahoppen ahoppen requested a review from akyrtzi April 27, 2021 05:51
@ahoppen ahoppen changed the title [SourceKit] Don’t transform type when printing if CurrentType can’t have members [5.5][SourceKit] Don’t transform type when printing if CurrentType can’t have members Apr 27, 2021
@ahoppen ahoppen added the r5.5 label Apr 27, 2021
@ahoppen
Copy link
Member Author

ahoppen commented Apr 27, 2021

@swift-ci Please test

@ahoppen ahoppen merged commit c30b098 into swiftlang:release/5.5 Apr 27, 2021
@ahoppen ahoppen deleted the pr-5.5/check-may-have-members branch April 27, 2021 18:43
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.5 labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants