Skip to content

Conversation

@AnthonyLatsis
Copy link
Collaborator

The only case a singleton metatype transforms into an existential metatype is when the instance type transforms into an existential from a non-existential.

Resolves #72941.


NB: Type erasure correctness is not enough to fix crashes in cases like the one in the linked issue — A?.Type to B?.Type where A <: B — because the compiler does not support these correct conversions to begin with. With nothing stopping them from surviving the constraint solver, they either trip an assertion somewhere down the line or sometimes even compile. Handle these cases gracefully by requiring the constraint system to certify conversions associated with existential member accesses.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Incorporated this test into test/decl/protocol/existential_member_accesses_self_assoctype.swift here .

The only case a singleton metatype transforms into an existential metatype is
when the instance type transforms into an existential from a non-existential.
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test macOS

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test Linux

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please test source compatibility release

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test Windows

@AnthonyLatsis AnthonyLatsis enabled auto-merge April 19, 2024 11:48
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test macOS

@AnthonyLatsis AnthonyLatsis merged commit 2237658 into swiftlang:main Apr 19, 2024
@AnthonyLatsis AnthonyLatsis deleted the brassica-oleracea branch April 19, 2024 14:51
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.

Compiler crash with dynamic generic

2 participants