This is what I traced this down to:
exprTypeArgs: tparams = List(type T, type Coll), tvars = List(?T, ?
Coll), (implicit elemPickler:
scala.pickling.Pickler[T])scala.pickling.Pickler[Coll[T]] = restpe,
instResTp = (implicit elemPickler: scala.pickling.Pickler[?
T])scala.pickling.Pickler[?Coll], pt = scala.pickling.Pickler[XXX],
useWeaklyCompatible=true
isWeaklyCompatible: tp1 = scala.pickling.Pickler[?Coll], pt =
scala.pickling.Pickler[XXX]
When XXX is Any, isWeaklyCompatible returns true. This triggers a
successful solveTypes, which returns back to typedImplicit1,
triggering a recursive implicit search, which diverges, crashes
bestImplicit with DivergentImplicit, which causes implicit search to
skip searching in the companion.
But if XXX is anything other than Any (I tried Int and AnyRef), the
result of isWeaklyCompatible is false, type inference fails and the
problematic implicit search is never started. bestImplicit doesn't
crash, but rather returns SearchFailure, then control flow reaches
companion implicit searches, which finds conjure.
Two questions:
1) What's the magic role of Any here? Why is it under Any that type
inference succeeds?
2) How come a divergent implicit error can prevent companion implicits
from being looked into?