Skip to content
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

Fix two opaque return type bugs #60044

Merged
merged 3 commits into from Jul 15, 2022

Conversation

@slavapestov slavapestov force-pushed the fix-two-opaque-return-type-bugs branch from e3482a4 to e766f95 Compare July 13, 2022 21:14
// If we don't have substitutions, this is an opaque archetype from
// another declaration being manipulated, and not an erasure of a
// concrete type to an opaque type inside its defining declaration.
if (!substitutions.empty()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@hborla @xedin Is there a better way to check if this is the point of inference of the underlying type of an opaque return type, and not merely a usage of an opaque return type from a different context?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think there is a better way to check this unfortunately...

@slavapestov slavapestov requested review from hborla and xedin and removed request for hborla July 13, 2022 21:16
@slavapestov
Copy link
Member Author

@swift-ci Please smoke test

This cannot be represented in the ABI because we expect that the
opaque return type can be instantiated from the generic arguments
of its declaring context. Reconstructing type metadata for the
DynamicSelfType would require opaque return type instantiation
to also take the self *value*.

Fixes rdar://72407668 / apple#56367
…tion

Move the check where we insert UnderlyingToOpaqueExpr earlier in
coerceToType(). Otherwise, returning a metatype or function type
would attempt to perform a conversion instead of building a
UnderlyingToOpaqueExpr.

Fixes part of apple#60038.
@slavapestov slavapestov force-pushed the fix-two-opaque-return-type-bugs branch from e766f95 to 78e9af7 Compare July 14, 2022 15:08
@slavapestov
Copy link
Member Author

@swift-ci Please smoke test

@slavapestov
Copy link
Member Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 0ca2cc9 into apple:main Jul 15, 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
2 participants