Skip to content

Sema: Fix inherited designated init synthesis when there's a 'where' clause but no new generic parameters #35727

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

SE-0267 allows where clauses on declarations without their own generic
parameters, which means we can longer assume that if getGenericParams()
returns nullptr on a constructor, then the constructor has the same
generic signature as its parent class.

Instead, explicitly compare the superclass constructor's generic
signature with that of the superclass, and if they don't match,
compute a new generic signature for the override.

Fixes https://bugs.swift.org/browse/SR-14118 / rdar://73764827.

…clause but no new generic parameters

SE-0267 allows where clauses on declarations without their own generic
parameters, which means we can longer assume that if getGenericParams()
returns nullptr on a constructor, then the constructor has the same
generic signature as its parent class.

Instead, explicitly compare the superclass constructor's generic
signature with that of the superclass, and if they don't match,
compute a new generic signature for the override.

Fixes https://bugs.swift.org/browse/SR-14118 / rdar://73764827.
@slavapestov slavapestov force-pushed the inherited-designated-init-with-where-clause branch from 79ee071 to 3dfbf15 Compare February 3, 2021 04:12
@slavapestov
Copy link
Contributor Author

@jckarter Thanks for diagnosing the issue!

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov requested a review from jckarter February 3, 2021 04:13
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov slavapestov merged commit ab03052 into swiftlang:main Feb 3, 2021
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.

1 participant