@@ -18,6 +18,7 @@ import ast.Trees
1818import config .{Feature , ScalaVersion }
1919import typer .ErrorReporting .{err , matchReductionAddendum }
2020import typer .ProtoTypes .ViewProto
21+ import typer .Implicits .Candidate
2122import scala .util .control .NonFatal
2223import StdNames .nme
2324import printing .Formatting .hl
@@ -2516,14 +2517,25 @@ import transform.SymUtils._
25162517 | """ .stripMargin
25172518 }
25182519
2519- class ImplicitSearchTooLargeWarning (limit : Int )(using Context ) extends TypeMsg (ImplicitSearchTooLargeID ):
2520+ class ImplicitSearchTooLargeWarning (limit : Int , openSearchPairs : List [(Candidate , Type )])(using Context )
2521+ extends TypeMsg (ImplicitSearchTooLargeID ):
25202522 override def showAlways = true
2523+ def showQuery (query : (Candidate , Type )): String =
2524+ i " ${query._1.ref.symbol.showLocated} for ${query._2}} "
25212525 def msg =
25222526 em """ Implicit search problem too large.
25232527 |an implicit search was terminated with failure after trying $limit expressions.
2528+ |The root candidate for the search was:
2529+ |
2530+ | ${showQuery(openSearchPairs.last)}
25242531 |
25252532 |You can change the behavior by setting the `-Ximplicit-search-limit` value.
25262533 |Smaller values cause the search to fail faster.
25272534 |Larger values might make a very large search problem succeed.
25282535 | """
2529- def explain = " "
2536+ def explain =
2537+ em """ The overflow happened with the following lists of tried expressions and target types,
2538+ |starting with the root query:
2539+ |
2540+ | ${openSearchPairs.reverse.map(showQuery)}%\n%
2541+ """
0 commit comments