[4.1] Associated type fixes for extraneous recursion, crashes, inference failure #14159
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: Associated type inference regressed quite a bit in 4.1, crashing more often (particularly when dealing with recursive constraints as in the
Collection
protocols) and failing to infer in some cases where 4.0 successfully inferred associated types. This pull request addresses a number of these issues.• Scope of Issue: Affects associated type inference is used whenever a conformance to a protocol with associated types is type-checked. We've seen a number of reports of regressions here.
• Origination: Recursive protocol conformances, conditional conformances, and the reshuffling of the standard library protocols uncovered existing problems with associated type inference.
• Risk: Low-ish risk; the change is breaking recursion that could go infinite, and allowing associated type inference to succeed in a few more cases, so it shouldn't cause more regressions.
• Reviewed By: @xedin
• Testing: Compiler regression tests, including new tests for each of the bugs addressed, and building known-affected open-source projects (e.g., Bond).
• Radar / SR: SR-6609 / rdar://problem/36038033, rdar://problem/36453271, rdar://problem/16316115, SR-6746 / rdar://problem/36483751.