Skip to content

[ConstraintSystem] Always choose an available type eraser type. #79406

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 1 commit into from
Feb 15, 2025

Conversation

hborla
Copy link
Member

@hborla hborla commented Feb 14, 2025

If no available type eraser type exists, do not perform type erasure. If multiple available type erasers exist, choose the least available type eraser type. The type eraser type's availability is compared against the availability within the lexical context of the erased expression to determine whether the type eraser type is available.

There may be better approaches, such as leveraging SE-0360: Opaque result types with limited availability to choose the type eraser type at runtime, but this minimal change at least lets a type eraser type be replaced without causing runtime crashes when that new type is not available at runtime.

Resolves: rdar://144572195

If no available type eraser type exists, do not perform type erasure. If
multiple type erasers exist, choose the least available type eraser type.
Which type eraser to choose is based on the availability of the lexical
context of the erased expression.
@hborla
Copy link
Member Author

hborla commented Feb 14, 2025

@swift-ci please smoke test

@hborla hborla requested a review from tshortli February 14, 2025 23:10
@hborla hborla merged commit 34cc3e8 into swiftlang:main Feb 15, 2025
3 checks passed
@hborla hborla deleted the type-eraser-availability branch February 15, 2025 18:49
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