scala.quoted.runtime.impl.ExprCastException.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala3-compiler_3 Show documentation
Show all versions of scala3-compiler_3 Show documentation
scala3-compiler-bootstrapped
package scala.quoted.runtime.impl
import dotty.tools.dotc.ast.tpd.Tree
import dotty.tools.dotc.core.Contexts.*
class ExprCastException(msg: String) extends Exception(msg)
object ExprCastException:
def apply(expectedType: String, actualType: String, exprCode: String): ExprCastException =
new ExprCastException(
s"""|
| Expected type: ${formatLines(expectedType)}
| Actual type: ${formatLines(actualType)}
| Expression: ${formatLines(exprCode)}
|""".stripMargin)
private def formatLines(str: String): String =
if !str.contains("\n") then str
else str.linesIterator.mkString("\n ", "\n ", "\n")
© 2015 - 2025 Weber Informatics LLC | Privacy Policy