Skip to content

IRGen: Workaround for type substitution limitation #76486

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
Sep 16, 2024

Conversation

slavapestov
Copy link
Contributor

If a constrained extension has fewer conformance requirements than the nominal type declaration, because some of the type parameters of the nominal type are fixed to concrete types by the extension, we would run into trouble because interface type substitution does not correctly handle this case.

Applying an identity substitution map to an interface type does not look up concrete types in the output generic signature, so we get back a type parameter that is not valid.

getReducedType() has a hack to deal with this. I'd like to get rid of the hack and fix interface type substitution to do this correctly, but until then, this will do.

Fixes #76479

If a constrained extension has fewer conformance requirements
than the nominal type declaration, because some of the type
parameters of the nominal type are fixed to concrete types by
the extension, we would run into trouble because interface
type substitution does not correctly handle this case.

Applying an identity substitution map to an interface type
does not look up concrete types in the output generic
signature, so we get back a type parameter that is not valid.

getReducedType() has a hack to deal with this. I'd like to
get rid of the hack and fix interface type substitution to
do this correctly, but until then, this will do.

Fixes swiftlang#76479
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 0bd4e4e into swiftlang:main Sep 16, 2024
3 checks passed
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.

[6.0] Compiler crashes for code that was compiling with older toolchains
1 participant