Skip to content

CastOptimizer: fix optimization of casts from non-existentials to existentials #80137

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 2 commits into from
Mar 20, 2025

Conversation

eeckstein
Copy link
Contributor

We need to consider that archetypes (generic types) can be existentials if they conform to self-conforming protocols.

Fixes a miscompile
rdar://147269904

Checks if the type is an existential or an archetype which may be an existential.
…stentials

We need to consider that archetypes (generic types) can be existentials if they conform to self-conforming protocols.

Fixes a miscompile
rdar://147269904
@eeckstein eeckstein requested review from atrick, meg-gupta and nate-chandler and removed request for hborla March 19, 2025 19:32
@eeckstein
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values implicit existential opening Feature → existentials: implicit opening of existentials when passed to parameters of generic type labels Mar 19, 2025
@eeckstein eeckstein merged commit 29876fd into swiftlang:main Mar 20, 2025
5 checks passed
@eeckstein eeckstein deleted the fix-cast-optimizer branch March 20, 2025 06:26
Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values implicit existential opening Feature → existentials: implicit opening of existentials when passed to parameters of generic type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants