Skip to content

SIL: Don't canonicalize struct field and enum element types against the wrong signature #33419

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

Conversation

slavapestov
Copy link
Contributor

The replacement types of the substitution map are either going
to be contextual types, or interface types using some generic
signature. There is no requirement that this generic signature
is the generic signature of the type declaration itself.

By using the generic signature of the type declaration, we
could incorrectly canonicalize generic parameters to concrete
types if the type itself was defined in a constrained extension,
as in the test case here.

Fixes rdar://problem/65272763.

…he wrong signature

The replacement types of the substitution map are either going
to be contextual types, or interface types using some generic
signature. There is no requirement that this generic signature
is the generic signature of the type declaration itself.

By using the generic signature of the type declaration, we
could incorrectly canonicalize generic parameters to concrete
types if the type itself was defined in a constrained extension,
as in the test case here.

Fixes <rdar://problem/65272763>.
@slavapestov slavapestov requested a review from jckarter August 12, 2020 02:55
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test Linux

@jckarter
Copy link
Contributor

Hm, I'm surprised this doesn't regress anything, but if it passes the test and compatibility suite, OK.

@slavapestov
Copy link
Contributor Author

@jckarter I think you were right that this extra canonicalization step was papering over other bugs that were fixed when y'all refactored this to be more principled.

@slavapestov slavapestov merged commit bfb1e91 into swiftlang:master Aug 12, 2020
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