private[scala] def formatArgs()

in log4j-api-scala_3/src/main/scala/org/apache/logging/log4j/scala/LoggerMacro.scala [534:551]


  private[scala] def formatArgs(args: Expr[Seq[Any]])(using q: Quotes): Seq[Expr[Object]] = {
    import quotes.reflect.*
    import util.*

    args.asTerm match {
      case p@Inlined(_, _, Typed(Repeated(v, _),_)) =>
        v.map{
          case t if t.tpe <:< TypeRepr.of[AnyRef] => t.asExprOf[Object]
          case t => '{${t.asExpr}.asInstanceOf[Object]}
        }
      case Repeated(v, _) =>
        v.map{
          case t if t.tpe <:< TypeRepr.of[Object] => t.asExprOf[Object]
          case t => '{${t.asExpr}.asInstanceOf[Object]}
        }
      case _ => Seq.empty
    }
  }