def issueFallbackWarning[T: c.WeakTypeTag]()

in elitzur-core/src/main/scala/com/spotify/elitzur/validators/ValidatorMacros.scala [93:126]


  def issueFallbackWarning[T: c.WeakTypeTag](c: whitebox.Context): c.Tree = {
    import c.universe._

    val wtt = weakTypeOf[T]
    val TypeRef(_, sym, args) = wtt
    val typeName = sym.name
    val params = args.headOption
      .map { _ =>
        args.mkString("[", ",", "]")
      }
      .getOrElse("")
    val fullType = typeName.toString + params

    val warning =
      s"""
         | Warning: No implicit Validator found for the following type:
         |
         |   >>  $wtt
         |
         | You can add a Validator for this type like this:
         |
         |    implicit val <yourValidatorName> = new IgnoreValidator[$fullType]
         |
         | If this is a primitive or a type other people use please consider contributing this
         | back to elitzur
         | """.stripMargin

    val shouldWarn = showWarn(c)
    // TODO this doesn't show up when using c.warning.  We might want to use that
    if (shouldWarn) c.echo(c.enclosingPosition, warning)

    val fallback = q"""new _root_.com.spotify.elitzur.validators.IgnoreValidator[$wtt]"""
    fallback
  }