Sema: Fix logic error in TypeReprCycleCheckWalker handling of 'Self.Foo' [5.10] #70831
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.
Cherry-pick of #70830
Description: Fixes a regression where associated type inference did not consider any witness whose type contains
Self.Foo, whereFoois a member of a protocol (usually you can writeFooinstead ofSelf.Foo, but the latter is more explicit). The correct behavior is that such witnesses should only be discarded ifFoois one of the associated types being inferred.Scope of the issue: Anyone impacted would have to explicitly declare a type alias instead of letting the compiler infer it.
Origination: Regression from the second cherry-pick in Sema: Associated type inference fixes [5.10] #70696.
Radar: Fixes rdar://problem/120743365.
Tested: Reduced test case added from impacted project.
Risk: Sigh. Unfortunately this is the second follow-up PR fixing issues in the original change from November (Sema: Associated type inference skips witnesses that might trigger a request cycle [5.10] #69952), but I hope this particular change is safe since the new code path (ignoring a witness that "might cause a cycle") will now execute in strictly fewer situations than it did previously.
Reviewed by: @hborla