Skip to content

Conversation

@Alex1005a
Copy link
Contributor

@Alex1005a Alex1005a commented Jan 26, 2026

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.

trait A[T]
implicit def diverge[T](implicit d1: DummyImplicit, d2: DummyImplicit): A[T] = ???
implicit def good[T](implicit a: A[T]): A[T] = ???
def geta[T: A] = ???
def testgeta = {
  geta // diverging implicit search
}

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler runs indefinitely for failed implicit search Slow performance in a combination of features

2 participants