Fix #24193: Do not try equally preferred alternatives in case of divergent implicit #25109
+49
−0
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.
Fixes #24193
In case of implicit search specified in the test, it takes O(n!) attempts to return the error:
No given instance of type Clock.To avoid this, a skip of attempts is added for equally preferred alternatives in case of a divergent implicit error (with the same type as the one being searched for), because if the implicit is found, there will still be an ambiguous implicit error.
Because of this condition, in some places there may now be a divergent implicit error instead of an ambiguous implicit.
In theory, this could result in no constraints being imposed on the result type where they were previously, but I haven't found a way to reproduce this yet.
This PR also possibly fixes #18763 (I definitely saw a decrease in the number of implicit searches when debugging).