[Sema] Handle invalid @_specialize generic signatures#89239
Open
Jiaxu-Li wants to merge 2 commits into
Open
Conversation
Reject invalid @_specialize generic signatures before serialization can reconstruct interface types from inconsistent requirement-machine state. Add a reduced regression test for swiftlang#89154. Resolves swiftlang#89154
slavapestov
reviewed
May 19, 2026
slavapestov
left a comment
Contributor
There was a problem hiding this comment.
Can you spilt this up into multiple commits? It's a pretty involved set of changes and I'd like to go through them one by one.
Contributor
Author
|
@swift-ci Please test |
Contributor
|
@Jiaxu-Li quoting your bug report:
If this is indeed the root cause of the problem, the fix should be in conformance lookup itself. We shouldn't be adding workarounds to the requirement machine, otherwise other callers might similarly get inconsistent results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
Invalid
@_specializegeneric signatures are now rejected gracefully instead of crashing during interface type reconstruction.Scope:
Updates specialize attribute validation, printing, and requirement-machine recovery for invalid associated type witnesses.
Issues:
Resolves [Swift][Specialization] Assertion std::find(conformsTo) != conformsTo.end() in getTypeForSymbolRange when serializing @_specialize generic signature with ambiguous type used in associated type chain #89154
Risk:
Low. The change is limited to invalid-signature recovery after diagnostics have already been emitted.
Testing:
Added a reduced crash regression test on macOS.