Loosen hardlimit application heuristic slightly #50579
Open
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.
Ordinarily our recursion heuristic looks for recursion of edges, widening types to force convergence if a a recursion of edges is detected. However, under some circumstances (currently - as of #31734 when there are multiple applicable methods), we fall back to simple recursion of methods. This can be quite limiting for packages that have a big central dispatch method (e.g. Diffractor). This attempts to find a middle ground by applying the hardlimit fallback only if the split signatures are not concrete. The kind of case that we want to catch here often arise from signatures with unresolved Vararg (where there's a lot of destructuring methods, but since the size of the vararg is not known, we never terminate) or overly abstract types. I'm hoping this provides a better middle ground tradeoff by still prohibiting those kinds of cases while allowing otherwise very concretely inferred code that just happens to dispatch through a central higher-order method.