Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Utility for printing resolved implicit chain #21878

jatcwang started this conversation in Feature Requests
Discussion options

I recently was debugging implicit resolution issues and I found it quite useful to print out the fully resolved implicit chain

This is the basic implementation I had:

import scala.quoted.*
inline def printResolvedImplicit[A]: Unit =
 ${ printResolvedImplicitImpl[A] }
private def printResolvedImplicitImpl[A](using quotes: Quotes, t: Type[A]): Expr[Unit] =
 import quotes.reflect.*
 Expr.summon[A].match {
 case Some(ex) => println(ex.asTerm.show(using Printer.TreeCode))
 case None => report.error("Implicit resolution failed")
 }
 '{ () }

Does something exist in the Scala 3 std lib? Is it useful enough to be included?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /