Skip to content

[4.1] [GSB] Ensure that we don't build an invalid potential archetype. #14102

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
Jan 24, 2018

Conversation

DougGregor
Copy link
Member

Explanation: Name mangling of constrained extensions could cause a crash in rare-ish cases because the code can break invariants of the GenericSignatureBuilder.
Scope of Issue: Causes SIL crashes when compiling some fairly-complex constrained extensions. We've seen one confirmed and one suspected case of this in the wild.
Origination: My work to optimize the mangling of generic signatures (so they don't redundantly specify the requirements of the enclosing generic context) introduced the offending code.
Risk: Low risk; we're validating our inputs to the GenericSignatureBuilder in a way that will only either (1) delay resolution of requirements until later, or (2) properly return false for queries that would previously have caused downstream crashes.
Reviewed By: @rudkx
Testing: Compiler regression tests, built RandomKit project
Radar / SR: rdar://problem/36673825 / SR-6797

Fixes the crash in SR-6797 / rdar://problem/36673825.

(cherry picked from commit d18ecda)

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

Queries against the generic signature might use types that are
ill-formed for that generic signature, e.g., because they refer to
associated types of unrelated protocols. Detect such conditions to
maintain GSB invariants that all potential archetypes in a well-formed
generic signature are well-formed.

Fixes the crash in SR-6797 / rdar://problem/36673825.

(cherry picked from commit d18ecda)
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please nominate

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