[4.1] [GSB] Ensure that we don't build an invalid potential archetype. #14102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
• 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 returnfalse
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.