Skip to content

Serialization: Preserve identity of opened generic environments #60523

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

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Aug 12, 2022

Serialization did not record the generic environment of an opened archetype at all.

If a SIL function referenced two opened archetypes @opened(123, P) Self and @ opened(123, P) Self.A from the same generic environment, we would deserialize them into two different generic environments, like @opened(123, P) Self and @opened(321, P) Self.A, so the root archetype of @opened(321, P) Self.A would be @opened(321, P) Self and not @opened(123, P) Self as expected. This would trigger an assertion when collecting type-dependent operands, because this bogus root archetype was not produced by any instruction in the function.

Also, clean up a few things in this area. Only the serialization commit is the bug fix; the rest should be NFC.

@slavapestov slavapestov requested a review from atrick August 12, 2022 04:17
@slavapestov slavapestov force-pushed the fix-opened-generic-environment-identity branch from 405ba5b to ddf9168 Compare August 12, 2022 04:23
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov force-pushed the fix-opened-generic-environment-identity branch from ddf9168 to 9c094c5 Compare August 16, 2022 15:59
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit cfb4e60 into swiftlang:main Aug 16, 2022
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