Using summonInline[T] with summon[T] for resolving implicits in inline methods

I agree that it’s pretty annoying that you have to explicitly pass around all implicits with summonInline in these cases. It can also take a while to figure out what’s going wrong if you forget one.

Perhaps as a compromise we could have a compileTimeOnly method scala.compiletime.summoningInline that enables summonInline as the default summoning method in a limited scope.

inline def printTC3Inline(): Unit = summoningInline {
  ImplicitUsing.useImpl[String]
}
1 Like