diff --git a/community-build/src/scala/dotty/communitybuild/FieldsImpl.scala b/community-build/src/scala/dotty/communitybuild/FieldsImpl.scala index 045f34271ea4..264e8cd7fd56 100644 --- a/community-build/src/scala/dotty/communitybuild/FieldsImpl.scala +++ b/community-build/src/scala/dotty/communitybuild/FieldsImpl.scala @@ -14,4 +14,4 @@ object FieldsImpl: val projectsTree = Term.of(from) val symbols = TypeTree.of[V].symbol.memberMethods.filter(isProjectField) val selects = symbols.map(Select(projectsTree, _).asExprOf[T]) - '{ println(${Expr(retType.show)}); ${Varargs(selects)} } + '{ println(${Value(retType.show)}); ${Varargs(selects)} } diff --git a/docs/docs/reference/changed-features/numeric-literals.md b/docs/docs/reference/changed-features/numeric-literals.md index 05477a15533d..2c3209edb02b 100644 --- a/docs/docs/reference/changed-features/numeric-literals.md +++ b/docs/docs/reference/changed-features/numeric-literals.md @@ -205,7 +205,7 @@ implementation method `fromDigitsImpl`. Here is its definition: case Some(ds) => try { val BigFloat(m, e) = apply(ds) - '{BigFloat(${Expr(m)}, ${Expr(e)})} + '{BigFloat(${Value(m)}, ${Value(e)})} } catch { case ex: FromDigits.FromDigitsException => diff --git a/docs/docs/reference/contextual/derivation-macro.md b/docs/docs/reference/contextual/derivation-macro.md index 810332ddbf22..e745bd9b0625 100644 --- a/docs/docs/reference/contextual/derivation-macro.md +++ b/docs/docs/reference/contextual/derivation-macro.md @@ -50,10 +50,10 @@ given derived[T: Type](using Quotes): Expr[Eq[T]] = { case '{ $m: Mirror.ProductOf[T] { type MirroredElemTypes = elementTypes }} => val elemInstances = summonAll[elementTypes] val eqProductBody: (Expr[T], Expr[T]) => Expr[Boolean] = (x, y) => { - elemInstances.zipWithIndex.foldLeft(Expr(true: Boolean)) { + elemInstances.zipWithIndex.foldLeft(Value(true: Boolean)) { case (acc, (elem, index)) => - val e1 = '{$x.asInstanceOf[Product].productElement(${Expr(index)})} - val e2 = '{$y.asInstanceOf[Product].productElement(${Expr(index)})} + val e1 = '{$x.asInstanceOf[Product].productElement(${Value(index)})} + val e2 = '{$y.asInstanceOf[Product].productElement(${Value(index)})} '{ $acc && $elem.asInstanceOf[Eq[Any]].eqv($e1, $e2) } } @@ -185,10 +185,10 @@ object Eq { case '{ $m: Mirror.ProductOf[T] { type MirroredElemTypes = elementTypes }} => val elemInstances = summonAll[elementTypes] val eqProductBody: (Expr[T], Expr[T]) => Expr[Boolean] = (x, y) => { - elemInstances.zipWithIndex.foldLeft(Expr(true: Boolean)) { + elemInstances.zipWithIndex.foldLeft(Value(true: Boolean)) { case (acc, (elem, index)) => - val e1 = '{$x.asInstanceOf[Product].productElement(${Expr(index)})} - val e2 = '{$y.asInstanceOf[Product].productElement(${Expr(index)})} + val e1 = '{$x.asInstanceOf[Product].productElement(${Value(index)})} + val e2 = '{$y.asInstanceOf[Product].productElement(${Value(index)})} '{ $acc && $elem.asInstanceOf[Eq[Any]].eqv($e1, $e2) } } diff --git a/docs/docs/reference/metaprogramming/macros.md b/docs/docs/reference/metaprogramming/macros.md index 8e3e8a715ef6..8c7dcf1a6d19 100644 --- a/docs/docs/reference/metaprogramming/macros.md +++ b/docs/docs/reference/metaprogramming/macros.md @@ -246,7 +246,7 @@ import scala.quoted._ def compile(e: Exp, env: Map[String, Expr[Int]])(using Quotes): Expr[Int] = e match { case Num(n) => - Expr(n) + Value(n) case Plus(e1, e2) => '{ ${ compile(e1, env) } + ${ compile(e2, env) } } case Var(x) => @@ -259,8 +259,8 @@ Running `compile(letExp, Map())` would yield the following Scala code: ```scala '{ val y = 3; (2 + y) + 4 } ``` -The body of the first clause, `case Num(n) => Expr(n)`, looks suspicious. `n` -is declared as an `Int`, yet it is converted to an `Expr[Int]` with `Expr()`. +The body of the first clause, `case Num(n) => Value(n)`, looks suspicious. `n` +is declared as an `Int`, yet it is converted to an `Expr[Int]` with `Value()`. Shouldn’t `n` be quoted? In fact this would not work since replacing `n` by `'n` in the clause would not be phase correct. @@ -312,7 +312,7 @@ a `List` is liftable if its element type is: ```scala given [T: ToExpr : Type]: ToExpr[List[T]] with def toExpr(xs: List[T]) = xs match { - case head :: tail => '{ ${ Expr(head) } :: ${ toExpr(tail) } } + case head :: tail => '{ ${ Value(head) } :: ${ toExpr(tail) } } case Nil => '{ Nil: List[T] } } ``` @@ -326,7 +326,7 @@ Using lifting, we can now give the missing definition of `showExpr` in the intro ```scala def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = { val code: String = expr.show - Expr(code) + Value(code) } ``` That is, the `showExpr` method converts its `Expr` argument to a string (`code`), and lifts @@ -375,7 +375,7 @@ object Macros { ${ assertImpl('expr) } def assertImpl(expr: Expr[Boolean])(using Quotes) = - val failMsg: Expr[String] = Expr("failed assertion: " + expr.show) + val failMsg: Expr[String] = Value("failed assertion: " + expr.show) '{ if !($expr) then throw new AssertionError($failMsg) } } @@ -641,14 +641,14 @@ These could be used in the following way to optimize any call to `sum` that has ```scala inline def sum(inline args: Int*): Int = ${ sumExpr('args) } private def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes): Expr[Int] = argsExpr match { - case Varargs(args @ Exprs(argValues)) => + case Varargs(args @ Values(argValues)) => // args is of type Seq[Expr[Int]] // argValues is of type Seq[Int] - Expr(argValues.sum) // precompute result of sum + Value(argValues.sum) // precompute result of sum case Varargs(argExprs) => // argExprs is of type Seq[Expr[Int]] val staticSum: Int = argExprs.map(_.value.getOrElse(0)) val dynamicSum: Seq[Expr[Int]] = argExprs.filter(_.value.isEmpty) - dynamicSum.foldLeft(Expr(staticSum))((acc, arg) => '{ $acc + $arg }) + dynamicSum.foldLeft(Value(staticSum))((acc, arg) => '{ $acc + $arg }) case _ => '{ $argsExpr.sum } } @@ -671,7 +671,7 @@ def sum(args: Int*): Int = args.sum inline def optimize(inline arg: Int): Int = ${ optimizeExpr('arg) } private def optimizeExpr(body: Expr[Int])(using Quotes): Expr[Int] = body match { // Match a call to sum without any arguments - case '{ sum() } => Expr(0) + case '{ sum() } => Value(0) // Match a call to sum with an argument $n of type Int. n will be the Expr[Int] representing the argument. case '{ sum($n) } => n // Match a call to sum and extracts all its args in an `Expr[Seq[Int]]` @@ -686,7 +686,7 @@ private def sumExpr(args1: Seq[Expr[Int]])(using Quotes): Expr[Int] = { val args2 = args1.flatMap(flatSumArgs) val staticSum: Int = args2.map(_.value.getOrElse(0)).sum val dynamicSum: Seq[Expr[Int]] = args2.filter(_.value.isEmpty) - dynamicSum.foldLeft(Expr(staticSum))((acc, arg) => '{ $acc + $arg }) + dynamicSum.foldLeft(Value(staticSum))((acc, arg) => '{ $acc + $arg }) } ``` @@ -762,7 +762,7 @@ private def evalExpr(e: Expr[Int])(using Quotes): Expr[Int] = { evalExpr(Expr.betaReduce(body)(evalExpr(x))) case '{ ($x: Int) * ($y: Int) } => (x.value, y.value) match - case (Some(a), Some(b)) => Expr(a * b) + case (Some(a), Some(b)) => Value(a * b) case _ => e case _ => e } diff --git a/library/src-bootstrapped/scala/quoted/Expr.scala b/library/src-bootstrapped/scala/quoted/Expr.scala index 7f4212910986..782dc4b22de2 100644 --- a/library/src-bootstrapped/scala/quoted/Expr.scala +++ b/library/src-bootstrapped/scala/quoted/Expr.scala @@ -33,21 +33,23 @@ object Expr { } /** Creates an expression that will construct the value `x` */ + @deprecated("Use `scala.quoted.Value.apply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") def apply[T](x: T)(using ToExpr[T])(using Quotes): Expr[T] = scala.Predef.summon[ToExpr[T]].apply(x) /** Get `Some` of a copy of the value if the expression contains a literal constant or constructor of `T`. - * Otherwise returns `None`. - * - * Usage: - * ``` - * case '{ ... ${expr @ Expr(value)}: T ...} => - * // expr: Expr[T] - * // value: T - * ``` - * - * To directly get the value of an expression `expr: Expr[T]` consider using `expr.value`/`expr.valueOrError` insead. - */ + * Otherwise returns `None`. + * + * Usage: + * ``` + * case '{ ... ${expr @ Expr(value)}: T ...} => + * // expr: Expr[T] + * // value: T + * ``` + * + * To directly get the value of an expression `expr: Expr[T]` consider using `expr.value`/`expr.valueOrError` insead. + */ + @deprecated("Use `scala.quoted.Value.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") def unapply[T](x: Expr[T])(using FromExpr[T])(using Quotes): Option[T] = scala.Predef.summon[FromExpr[T]].unapply(x) @@ -70,7 +72,7 @@ object Expr { * `'{ List($e1, $e2, ...) }` typed as an `Expr[List[T]]` */ def ofList[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[List[T]] = - if (xs.isEmpty) Expr(Nil) else '{ List(${Varargs(xs)}: _*) } + if (xs.isEmpty) Value(Nil) else '{ List(${Varargs(xs)}: _*) } /** Creates an expression that will construct a copy of this tuple * diff --git a/library/src-bootstrapped/scala/quoted/FromExpr.scala b/library/src-bootstrapped/scala/quoted/FromExpr.scala index 6ee462cd237f..40b21d04bdfd 100644 --- a/library/src-bootstrapped/scala/quoted/FromExpr.scala +++ b/library/src-bootstrapped/scala/quoted/FromExpr.scala @@ -100,9 +100,9 @@ object FromExpr { */ given OptionFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Option[T]] with { def unapply(x: Expr[Option[T]])(using Quotes) = x match { - case '{ Option[T](${Expr(y)}) } => Some(Option(y)) + case '{ Option[T](${Value(y)}) } => Some(Option(y)) case '{ None } => Some(None) - case '{ ${Expr(opt)} : Some[T] } => Some(opt) + case '{ ${Value(opt)} : Some[T] } => Some(opt) case _ => None } } @@ -124,8 +124,8 @@ object FromExpr { */ given SomeFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Some[T]] with { def unapply(x: Expr[Some[T]])(using Quotes) = x match { - case '{ new Some[T](${Expr(y)}) } => Some(Some(y)) - case '{ Some[T](${Expr(y)}) } => Some(Some(y)) + case '{ new Some[T](${Value(y)}) } => Some(Some(y)) + case '{ Some[T](${Value(y)}) } => Some(Some(y)) case _ => None } } @@ -136,8 +136,8 @@ object FromExpr { */ given StringContextFromExpr: FromExpr[StringContext] with { def unapply(x: Expr[StringContext])(using Quotes) = x match { - case '{ new StringContext(${Varargs(Consts(args))}: _*) } => Some(StringContext(args: _*)) - case '{ StringContext(${Varargs(Consts(args))}: _*) } => Some(StringContext(args: _*)) + case '{ new StringContext(${Varargs(Values(args))}: _*) } => Some(StringContext(args: _*)) + case '{ StringContext(${Varargs(Values(args))}: _*) } => Some(StringContext(args: _*)) case _ => None } } @@ -159,8 +159,8 @@ object FromExpr { */ given Tuple1FromExpr[T1](using Type[T1], FromExpr[T1]): FromExpr[Tuple1[T1]] with { def unapply(x: Expr[Tuple1[T1]])(using Quotes) = x match { - case '{ new Tuple1[T1](${Expr(y)}) } => Some(Tuple1(y)) - case '{ Tuple1[T1](${Expr(y)}) } => Some(Tuple1(y)) + case '{ new Tuple1[T1](${Value(y)}) } => Some(Tuple1(y)) + case '{ Tuple1[T1](${Value(y)}) } => Some(Tuple1(y)) case _ => None } } @@ -171,9 +171,9 @@ object FromExpr { */ given Tuple2FromExpr[T1, T2](using Type[T1], Type[T2], FromExpr[T1], FromExpr[T2]): FromExpr[Tuple2[T1, T2]] with { def unapply(x: Expr[Tuple2[T1, T2]])(using Quotes) = x match { - case '{ new Tuple2[T1, T2](${Expr(y1)}, ${Expr(y2)}) } => Some(Tuple2(y1, y2)) - case '{ Tuple2[T1, T2](${Expr(y1)}, ${Expr(y2)}) } => Some(Tuple2(y1, y2)) - case '{ (${Expr(y1)}: T1) -> (${Expr(y2)}: T2) } => Some(Tuple2(y1, y2)) + case '{ new Tuple2[T1, T2](${Value(y1)}, ${Value(y2)}) } => Some(Tuple2(y1, y2)) + case '{ Tuple2[T1, T2](${Value(y1)}, ${Value(y2)}) } => Some(Tuple2(y1, y2)) + case '{ (${Value(y1)}: T1) -> (${Value(y2)}: T2) } => Some(Tuple2(y1, y2)) case _ => None } } @@ -184,8 +184,8 @@ object FromExpr { */ given Tuple3FromExpr[T1, T2, T3](using Type[T1], Type[T2], Type[T3], FromExpr[T1], FromExpr[T2], FromExpr[T3]): FromExpr[Tuple3[T1, T2, T3]] with { def unapply(x: Expr[Tuple3[T1, T2, T3]])(using Quotes) = x match { - case '{ new Tuple3[T1, T2, T3](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}) } => Some(Tuple3(y1, y2, y3)) - case '{ Tuple3[T1, T2, T3](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}) } => Some(Tuple3(y1, y2, y3)) + case '{ new Tuple3[T1, T2, T3](${Value(y1)}, ${Value(y2)}, ${Value(y3)}) } => Some(Tuple3(y1, y2, y3)) + case '{ Tuple3[T1, T2, T3](${Value(y1)}, ${Value(y2)}, ${Value(y3)}) } => Some(Tuple3(y1, y2, y3)) case _ => None } } @@ -196,8 +196,8 @@ object FromExpr { */ given Tuple4FromExpr[T1, T2, T3, T4](using Type[T1], Type[T2], Type[T3], Type[T4], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4]): FromExpr[Tuple4[T1, T2, T3, T4]] with { def unapply(x: Expr[Tuple4[T1, T2, T3, T4]])(using Quotes) = x match { - case '{ new Tuple4[T1, T2, T3, T4](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}) } => Some(Tuple4(y1, y2, y3, y4)) - case '{ Tuple4[T1, T2, T3, T4](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}) } => Some(Tuple4(y1, y2, y3, y4)) + case '{ new Tuple4[T1, T2, T3, T4](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}) } => Some(Tuple4(y1, y2, y3, y4)) + case '{ Tuple4[T1, T2, T3, T4](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}) } => Some(Tuple4(y1, y2, y3, y4)) case _ => None } } @@ -208,8 +208,8 @@ object FromExpr { */ given Tuple5FromExpr[T1, T2, T3, T4, T5](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5]): FromExpr[Tuple5[T1, T2, T3, T4, T5]] with { def unapply(x: Expr[Tuple5[T1, T2, T3, T4, T5]])(using Quotes) = x match { - case '{ new Tuple5[T1, T2, T3, T4, T5](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}) } => Some(Tuple5(y1, y2, y3, y4, y5)) - case '{ Tuple5[T1, T2, T3, T4, T5](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}) } => Some(Tuple5(y1, y2, y3, y4, y5)) + case '{ new Tuple5[T1, T2, T3, T4, T5](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}) } => Some(Tuple5(y1, y2, y3, y4, y5)) + case '{ Tuple5[T1, T2, T3, T4, T5](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}) } => Some(Tuple5(y1, y2, y3, y4, y5)) case _ => None } } @@ -220,8 +220,8 @@ object FromExpr { */ given Tuple6FromExpr[T1, T2, T3, T4, T5, T6](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6]): FromExpr[Tuple6[T1, T2, T3, T4, T5, T6]] with { def unapply(x: Expr[Tuple6[T1, T2, T3, T4, T5, T6]])(using Quotes) = x match { - case '{ new Tuple6[T1, T2, T3, T4, T5, T6](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}) } => Some(Tuple6(y1, y2, y3, y4, y5, y6)) - case '{ Tuple6[T1, T2, T3, T4, T5, T6](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}) } => Some(Tuple6(y1, y2, y3, y4, y5, y6)) + case '{ new Tuple6[T1, T2, T3, T4, T5, T6](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}) } => Some(Tuple6(y1, y2, y3, y4, y5, y6)) + case '{ Tuple6[T1, T2, T3, T4, T5, T6](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}) } => Some(Tuple6(y1, y2, y3, y4, y5, y6)) case _ => None } } @@ -232,8 +232,8 @@ object FromExpr { */ given Tuple7FromExpr[T1, T2, T3, T4, T5, T6, T7](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7]): FromExpr[Tuple7[T1, T2, T3, T4, T5, T6, T7]] with { def unapply(x: Expr[Tuple7[T1, T2, T3, T4, T5, T6, T7]])(using Quotes) = x match { - case '{ new Tuple7[T1, T2, T3, T4, T5, T6, T7](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}) } => Some(Tuple7(y1, y2, y3, y4, y5, y6, y7)) - case '{ Tuple7[T1, T2, T3, T4, T5, T6, T7](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}) } => Some(Tuple7(y1, y2, y3, y4, y5, y6, y7)) + case '{ new Tuple7[T1, T2, T3, T4, T5, T6, T7](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}) } => Some(Tuple7(y1, y2, y3, y4, y5, y6, y7)) + case '{ Tuple7[T1, T2, T3, T4, T5, T6, T7](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}) } => Some(Tuple7(y1, y2, y3, y4, y5, y6, y7)) case _ => None } } @@ -244,8 +244,8 @@ object FromExpr { */ given Tuple8FromExpr[T1, T2, T3, T4, T5, T6, T7, T8](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8]): FromExpr[Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]] with { def unapply(x: Expr[Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]])(using Quotes) = x match { - case '{ new Tuple8[T1, T2, T3, T4, T5, T6, T7, T8](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}) } => Some(Tuple8(y1, y2, y3, y4, y5, y6, y7, y8)) - case '{ Tuple8[T1, T2, T3, T4, T5, T6, T7, T8](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}) } => Some(Tuple8(y1, y2, y3, y4, y5, y6, y7, y8)) + case '{ new Tuple8[T1, T2, T3, T4, T5, T6, T7, T8](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}) } => Some(Tuple8(y1, y2, y3, y4, y5, y6, y7, y8)) + case '{ Tuple8[T1, T2, T3, T4, T5, T6, T7, T8](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}) } => Some(Tuple8(y1, y2, y3, y4, y5, y6, y7, y8)) case _ => None } } @@ -256,8 +256,8 @@ object FromExpr { */ given Tuple9FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9]): FromExpr[Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]] with { def unapply(x: Expr[Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]])(using Quotes) = x match { - case '{ new Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}) } => Some(Tuple9(y1, y2, y3, y4, y5, y6, y7, y8, y9)) - case '{ Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}) } => Some(Tuple9(y1, y2, y3, y4, y5, y6, y7, y8, y9)) + case '{ new Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}) } => Some(Tuple9(y1, y2, y3, y4, y5, y6, y7, y8, y9)) + case '{ Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}) } => Some(Tuple9(y1, y2, y3, y4, y5, y6, y7, y8, y9)) case _ => None } } @@ -268,8 +268,8 @@ object FromExpr { */ given Tuple10FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10]): FromExpr[Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]] with { def unapply(x: Expr[Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]])(using Quotes) = x match { - case '{ new Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}) } => Some(Tuple10(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10)) - case '{ Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}) } => Some(Tuple10(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10)) + case '{ new Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}) } => Some(Tuple10(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10)) + case '{ Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}) } => Some(Tuple10(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10)) case _ => None } } @@ -280,8 +280,8 @@ object FromExpr { */ given Tuple11FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11]): FromExpr[Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]] with { def unapply(x: Expr[Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]])(using Quotes) = x match { - case '{ new Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}) } => Some(Tuple11(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11)) - case '{ Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}) } => Some(Tuple11(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11)) + case '{ new Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}) } => Some(Tuple11(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11)) + case '{ Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}) } => Some(Tuple11(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11)) case _ => None } } @@ -292,8 +292,8 @@ object FromExpr { */ given Tuple12FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12]): FromExpr[Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]] with { def unapply(x: Expr[Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]])(using Quotes) = x match { - case '{ new Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}) } => Some(Tuple12(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12)) - case '{ Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}) } => Some(Tuple12(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12)) + case '{ new Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}) } => Some(Tuple12(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12)) + case '{ Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}) } => Some(Tuple12(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12)) case _ => None } } @@ -304,8 +304,8 @@ object FromExpr { */ given Tuple13FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13]): FromExpr[Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]] with { def unapply(x: Expr[Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]])(using Quotes) = x match { - case '{ new Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}) } => Some(Tuple13(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13)) - case '{ Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}) } => Some(Tuple13(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13)) + case '{ new Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}) } => Some(Tuple13(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13)) + case '{ Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}) } => Some(Tuple13(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13)) case _ => None } } @@ -316,8 +316,8 @@ object FromExpr { */ given Tuple14FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14]): FromExpr[Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]] with { def unapply(x: Expr[Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]])(using Quotes) = x match { - case '{ new Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}) } => Some(Tuple14(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14)) - case '{ Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}) } => Some(Tuple14(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14)) + case '{ new Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}) } => Some(Tuple14(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14)) + case '{ Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}) } => Some(Tuple14(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14)) case _ => None } } @@ -328,8 +328,8 @@ object FromExpr { */ given Tuple15FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15]): FromExpr[Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]] with { def unapply(x: Expr[Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]])(using Quotes) = x match { - case '{ new Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}) } => Some(Tuple15(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15)) - case '{ Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}) } => Some(Tuple15(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15)) + case '{ new Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}) } => Some(Tuple15(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15)) + case '{ Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}) } => Some(Tuple15(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15)) case _ => None } } @@ -340,8 +340,8 @@ object FromExpr { */ given Tuple16FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16]): FromExpr[Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]] with { def unapply(x: Expr[Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]])(using Quotes) = x match { - case '{ new Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}) } => Some(Tuple16(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16)) - case '{ Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}) } => Some(Tuple16(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16)) + case '{ new Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}) } => Some(Tuple16(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16)) + case '{ Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}) } => Some(Tuple16(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16)) case _ => None } } @@ -352,8 +352,8 @@ object FromExpr { */ given Tuple17FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], Type[T17], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16], FromExpr[T17]): FromExpr[Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]] with { def unapply(x: Expr[Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]])(using Quotes) = x match { - case '{ new Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}) } => Some(Tuple17(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17)) - case '{ Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}) } => Some(Tuple17(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17)) + case '{ new Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}) } => Some(Tuple17(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17)) + case '{ Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}) } => Some(Tuple17(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17)) case _ => None } } @@ -364,8 +364,8 @@ object FromExpr { */ given Tuple18FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], Type[T17], Type[T18], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16], FromExpr[T17], FromExpr[T18]): FromExpr[Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]] with { def unapply(x: Expr[Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]])(using Quotes) = x match { - case '{ new Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}) } => Some(Tuple18(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18)) - case '{ Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}) } => Some(Tuple18(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18)) + case '{ new Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}) } => Some(Tuple18(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18)) + case '{ Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}) } => Some(Tuple18(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18)) case _ => None } } @@ -376,8 +376,8 @@ object FromExpr { */ given Tuple19FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], Type[T17], Type[T18], Type[T19], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16], FromExpr[T17], FromExpr[T18], FromExpr[T19]): FromExpr[Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]] with { def unapply(x: Expr[Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]])(using Quotes) = x match { - case '{ new Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}) } => Some(Tuple19(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19)) - case '{ Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}) } => Some(Tuple19(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19)) + case '{ new Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}) } => Some(Tuple19(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19)) + case '{ Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}) } => Some(Tuple19(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19)) case _ => None } } @@ -388,8 +388,8 @@ object FromExpr { */ given Tuple20FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], Type[T17], Type[T18], Type[T19], Type[T20], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16], FromExpr[T17], FromExpr[T18], FromExpr[T19], FromExpr[T20]): FromExpr[Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]] with { def unapply(x: Expr[Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]])(using Quotes) = x match { - case '{ new Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}, ${Expr(y20)}) } => Some(Tuple20(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20)) - case '{ Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}, ${Expr(y20)}) } => Some(Tuple20(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20)) + case '{ new Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}, ${Value(y20)}) } => Some(Tuple20(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20)) + case '{ Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}, ${Value(y20)}) } => Some(Tuple20(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20)) case _ => None } } @@ -400,8 +400,8 @@ object FromExpr { */ given Tuple21FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], Type[T17], Type[T18], Type[T19], Type[T20], Type[T21], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16], FromExpr[T17], FromExpr[T18], FromExpr[T19], FromExpr[T20], FromExpr[T21]): FromExpr[Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]] with { def unapply(x: Expr[Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]])(using Quotes) = x match { - case '{ new Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}, ${Expr(y20)}, ${Expr(y21)}) } => Some(Tuple21(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21)) - case '{ Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}, ${Expr(y20)}, ${Expr(y21)}) } => Some(Tuple21(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21)) + case '{ new Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}, ${Value(y20)}, ${Value(y21)}) } => Some(Tuple21(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21)) + case '{ Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}, ${Value(y20)}, ${Value(y21)}) } => Some(Tuple21(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21)) case _ => None } } @@ -412,8 +412,8 @@ object FromExpr { */ given Tuple22FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22](using Type[T1], Type[T2], Type[T3], Type[T4], Type[T5], Type[T6], Type[T7], Type[T8], Type[T9], Type[T10], Type[T11], Type[T12], Type[T13], Type[T14], Type[T15], Type[T16], Type[T17], Type[T18], Type[T19], Type[T20], Type[T21], Type[T22], FromExpr[T1], FromExpr[T2], FromExpr[T3], FromExpr[T4], FromExpr[T5], FromExpr[T6], FromExpr[T7], FromExpr[T8], FromExpr[T9], FromExpr[T10], FromExpr[T11], FromExpr[T12], FromExpr[T13], FromExpr[T14], FromExpr[T15], FromExpr[T16], FromExpr[T17], FromExpr[T18], FromExpr[T19], FromExpr[T20], FromExpr[T21], FromExpr[T22]): FromExpr[Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]] with { def unapply(x: Expr[Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]])(using Quotes) = x match { - case '{ new Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}, ${Expr(y20)}, ${Expr(y21)}, ${Expr(y22)}) } => Some(Tuple22(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21, y22)) - case '{ Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22](${Expr(y1)}, ${Expr(y2)}, ${Expr(y3)}, ${Expr(y4)}, ${Expr(y5)}, ${Expr(y6)}, ${Expr(y7)}, ${Expr(y8)}, ${Expr(y9)}, ${Expr(y10)}, ${Expr(y11)}, ${Expr(y12)}, ${Expr(y13)}, ${Expr(y14)}, ${Expr(y15)}, ${Expr(y16)}, ${Expr(y17)}, ${Expr(y18)}, ${Expr(y19)}, ${Expr(y20)}, ${Expr(y21)}, ${Expr(y22)}) } => Some(Tuple22(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21, y22)) + case '{ new Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}, ${Value(y20)}, ${Value(y21)}, ${Value(y22)}) } => Some(Tuple22(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21, y22)) + case '{ Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22](${Value(y1)}, ${Value(y2)}, ${Value(y3)}, ${Value(y4)}, ${Value(y5)}, ${Value(y6)}, ${Value(y7)}, ${Value(y8)}, ${Value(y9)}, ${Value(y10)}, ${Value(y11)}, ${Value(y12)}, ${Value(y13)}, ${Value(y14)}, ${Value(y15)}, ${Value(y16)}, ${Value(y17)}, ${Value(y18)}, ${Value(y19)}, ${Value(y20)}, ${Value(y21)}, ${Value(y22)}) } => Some(Tuple22(y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21, y22)) case _ => None } } @@ -425,10 +425,10 @@ object FromExpr { */ given SeqFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Seq[T]] with { def unapply(x: Expr[Seq[T]])(using Quotes) = x match { - case Varargs(Exprs(elems)) => Some(elems) - case '{ scala.Seq[T](${Varargs(Exprs(elems))}: _*) } => Some(elems) - case '{ scala.collection.immutable.Seq[T](${Varargs(Exprs(elems))}: _*) } => Some(elems) - case '{ ${Expr(x)}: List[T] } => Some(x) + case Varargs(Values(elems)) => Some(elems) + case '{ scala.Seq[T](${Varargs(Values(elems))}: _*) } => Some(elems) + case '{ scala.collection.immutable.Seq[T](${Varargs(Values(elems))}: _*) } => Some(elems) + case '{ ${Value(x)}: List[T] } => Some(x) case _ => None } } @@ -452,10 +452,10 @@ object FromExpr { */ given ListFromExpr[T](using Type[T], FromExpr[T]): FromExpr[List[T]] with { def unapply(x: Expr[List[T]])(using Quotes) = x match { - case '{ scala.List[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toList) + case '{ scala.List[T](${Varargs(Values(elems))}: _*) } => Some(elems.toList) case '{ scala.List.empty[T] } => Some(Nil) case '{ Nil } => Some(Nil) - case '{ scala.collection.immutable.List[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toList) + case '{ scala.collection.immutable.List[T](${Varargs(Values(elems))}: _*) } => Some(elems.toList) case '{ scala.collection.immutable.List.empty[T] } => Some(Nil) case _ => None } @@ -468,9 +468,9 @@ object FromExpr { */ given SetFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Set[T]] with { def unapply(x: Expr[Set[T]])(using Quotes) = x match { - case '{ Set[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toSet) + case '{ Set[T](${Varargs(Values(elems))}: _*) } => Some(elems.toSet) case '{ Set.empty[T] } => Some(Set.empty[T]) - case '{ scala.collection.immutable.Set[T](${Varargs(Exprs(elems))}: _*) } => Some(elems.toSet) + case '{ scala.collection.immutable.Set[T](${Varargs(Values(elems))}: _*) } => Some(elems.toSet) case '{ scala.collection.immutable.Set.empty[T] } => Some(Set.empty[T]) case _ => None } @@ -483,9 +483,9 @@ object FromExpr { */ given MapFromExpr[T, U](using Type[T], Type[U], FromExpr[T], FromExpr[U]): FromExpr[Map[T, U]] with { def unapply(x: Expr[Map[T, U]])(using Quotes) = x match { - case '{ Map[T, U](${Varargs(Exprs(elems))}: _*) } => Some(elems.toMap) + case '{ Map[T, U](${Varargs(Values(elems))}: _*) } => Some(elems.toMap) case '{ Map.empty[T, U] } => Some(Map.empty) - case '{ scala.collection.immutable.Map[T, U](${Varargs(Exprs(elems))}: _*) } => Some(elems.toMap) + case '{ scala.collection.immutable.Map[T, U](${Varargs(Values(elems))}: _*) } => Some(elems.toMap) case '{ scala.collection.immutable.Map.empty[T, U] } => Some(Map.empty) case _ => None } @@ -510,7 +510,7 @@ object FromExpr { */ given LeftFromExpr[L, R](using Type[L], Type[R], FromExpr[L]): FromExpr[Left[L, R]] with { def unapply(x: Expr[Left[L, R]])(using Quotes) = x match { - case '{ Left[L, R](${Expr(x)}) } => Some(Left(x)) + case '{ Left[L, R](${Value(x)}) } => Some(Left(x)) case _ => None } } @@ -521,7 +521,7 @@ object FromExpr { */ given RightFromExpr[L, R](using Type[L], Type[R], FromExpr[R]): FromExpr[Right[L, R]] with { def unapply(x: Expr[Right[L, R]])(using Quotes) = x match { - case '{ Right[L, R](${Expr(x)}) } => Some(Right(x)) + case '{ Right[L, R](${Value(x)}) } => Some(Right(x)) case _ => None } } diff --git a/library/src-bootstrapped/scala/quoted/ToExpr.scala b/library/src-bootstrapped/scala/quoted/ToExpr.scala index d5abc2c22c08..f9a9018d8b71 100644 --- a/library/src-bootstrapped/scala/quoted/ToExpr.scala +++ b/library/src-bootstrapped/scala/quoted/ToExpr.scala @@ -91,69 +91,69 @@ object ToExpr { /** Default implemetation of `ToExpr[ClassTag[T]]` */ given ClassTagToExpr[T: Type]: ToExpr[ClassTag[T]] with { def apply(ct: ClassTag[T])(using Quotes): Expr[ClassTag[T]] = - '{ ClassTag[T](${Expr(ct.runtimeClass.asInstanceOf[Class[T]])}) } + '{ ClassTag[T](${Value(ct.runtimeClass.asInstanceOf[Class[T]])}) } } /** Default implemetation of `ToExpr[Array[T]]` */ given ArrayToExpr[T: Type: ToExpr: ClassTag]: ToExpr[Array[T]] with { def apply(arr: Array[T])(using Quotes): Expr[Array[T]] = - '{ Array[T](${Expr(arr.toSeq)}: _*)(${Expr(summon[ClassTag[T]])}) } + '{ Array[T](${Value(arr.toSeq)}: _*)(${Value(summon[ClassTag[T]])}) } } /** Default implemetation of `ToExpr[Array[Boolean]]` */ given ArrayOfBooleanToExpr: ToExpr[Array[Boolean]] with { def apply(array: Array[Boolean])(using Quotes): Expr[Array[Boolean]] = if (array.length == 0) '{ Array.emptyBooleanArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Byte]]` */ given ArrayOfByteToExpr: ToExpr[Array[Byte]] with { def apply(array: Array[Byte])(using Quotes): Expr[Array[Byte]] = if (array.length == 0) '{ Array.emptyByteArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Short]]` */ given ArrayOfShortToExpr: ToExpr[Array[Short]] with { def apply(array: Array[Short])(using Quotes): Expr[Array[Short]] = if (array.length == 0) '{ Array.emptyShortArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Char]]` */ given ArrayOfCharToExpr: ToExpr[Array[Char]] with { def apply(array: Array[Char])(using Quotes): Expr[Array[Char]] = if (array.length == 0) '{ Array.emptyCharArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Int]]` */ given ArrayOfIntToExpr: ToExpr[Array[Int]] with { def apply(array: Array[Int])(using Quotes): Expr[Array[Int]] = if (array.length == 0) '{ Array.emptyIntArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Long]]` */ given ArrayOfLongToExpr: ToExpr[Array[Long]] with { def apply(array: Array[Long])(using Quotes): Expr[Array[Long]] = if (array.length == 0) '{ Array.emptyLongArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Float]]` */ given ArrayOfFloatToExpr: ToExpr[Array[Float]] with { def apply(array: Array[Float])(using Quotes): Expr[Array[Float]] = if (array.length == 0) '{ Array.emptyFloatArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[Array[Double]]` */ given ArrayOfDoubleToExpr: ToExpr[Array[Double]] with { def apply(array: Array[Double])(using Quotes): Expr[Array[Double]] = if (array.length == 0) '{ Array.emptyDoubleArray } - else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } + else '{ Array(${Value(array(0))}, ${Value(array.toSeq.tail)}: _*) } } /** Default implemetation of `ToExpr[IArray[T]]` */ @@ -183,27 +183,27 @@ object ToExpr { /** Default implemetation of `ToExpr[Set[T]]` */ given SetToExpr[T: Type: ToExpr]: ToExpr[Set[T]] with { def apply(set: Set[T])(using Quotes): Expr[Set[T]] = - '{ Set(${Expr(set.toSeq)}: _*) } + '{ Set(${Value(set.toSeq)}: _*) } } /** Default implemetation of `ToExpr[Map[T, U]]` */ given MapToExpr[T: Type: ToExpr, U: Type: ToExpr]: ToExpr[Map[T, U]] with { def apply(map: Map[T, U])(using Quotes): Expr[Map[T, U]] = - '{ Map(${Expr(map.toSeq)}: _*) } + '{ Map(${Value(map.toSeq)}: _*) } } /** Default implemetation of `ToExpr[Option[T]]` */ given OptionToExpr[T: Type: ToExpr]: ToExpr[Option[T]] with { def apply(x: Option[T])(using Quotes): Expr[Option[T]] = x match { - case x: Some[T] => Expr(x) - case None => Expr(None) + case x: Some[T] => Value(x) + case None => Value(None) } } /** Default implemetation of `ToExpr[Some[T]]` */ given SomeToExpr[T: Type: ToExpr]: ToExpr[Some[T]] with { def apply(x: Some[T])(using Quotes): Expr[Some[T]] = - '{ Some[T](${Expr(x.get)}) } + '{ Some[T](${Value(x.get)}) } } /** Default implemetation of `ToExpr[None.type]` */ @@ -215,20 +215,20 @@ object ToExpr { /** Default implemetation of `ToExpr[Either[L, R]]` */ given EitherToExpr[L: Type: ToExpr, R: Type: ToExpr]: ToExpr[Either[L, R]] with { def apply(x: Either[L, R])(using Quotes): Expr[Either[L, R]] = x match - case x: Left[L, R] => Expr(x) - case x: Right[L, R] => Expr(x) + case x: Left[L, R] => Value(x) + case x: Right[L, R] => Value(x) } /** Default implemetation of `ToExpr[Left[L, R]]` */ given LeftToExpr[L: Type: ToExpr, R: Type]: ToExpr[Left[L, R]] with { def apply(x: Left[L, R])(using Quotes): Expr[Left[L, R]] = - '{ Left[L, R](${Expr(x.value)}) } + '{ Left[L, R](${Value(x.value)}) } } /** Default implemetation of `ToExpr[Right[L, R]]` */ given RightToExpr[L: Type, R: Type: ToExpr]: ToExpr[Right[L, R]] with { def apply(x: Right[L, R])(using Quotes): Expr[Right[L, R]] = - '{ Right[L, R](${Expr(x.value)}) } + '{ Right[L, R](${Value(x.value)}) } } /** Default implemetation of `ToExpr[EmptyTuple.type]` */ @@ -240,32 +240,32 @@ object ToExpr { /** Default implemetation of `ToExpr[Tuple1[T1]]` */ given Tuple1ToExpr[T1: Type: ToExpr]: ToExpr[Tuple1[T1]] with { def apply(tup: Tuple1[T1])(using Quotes) = - '{ Tuple1(${Expr(tup._1)}) } + '{ Tuple1(${Value(tup._1)}) } } /** Default implemetation of `ToExpr[Tuple2[T1, T2]]` */ given Tuple2ToExpr[T1: Type: ToExpr, T2: Type: ToExpr]: ToExpr[Tuple2[T1, T2]] with { def apply(tup: Tuple2[T1, T2])(using Quotes) = - '{ (${Expr(tup._1)}, ${Expr(tup._2)}) } + '{ (${Value(tup._1)}, ${Value(tup._2)}) } } /** Default implemetation of `ToExpr[Tuple3[T1, T2, T3]]` */ given Tuple3ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr]: ToExpr[Tuple3[T1, T2, T3]] with { def apply(tup: Tuple3[T1, T2, T3])(using Quotes) = - '{ (${Expr(tup._1)}, ${Expr(tup._2)}, ${Expr(tup._3)}) } + '{ (${Value(tup._1)}, ${Value(tup._2)}, ${Value(tup._3)}) } } /** Default implemetation of `ToExpr[Tuple4[T1, T2, T3, T4]]` */ given Tuple4ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr]: ToExpr[Tuple4[T1, T2, T3, T4]] with { def apply(tup: Tuple4[T1, T2, T3, T4])(using Quotes) = - '{ (${Expr(tup._1)}, ${Expr(tup._2)}, ${Expr(tup._3)}, ${Expr(tup._4)}) } + '{ (${Value(tup._1)}, ${Value(tup._2)}, ${Value(tup._3)}, ${Value(tup._4)}) } } /** Default implemetation of `ToExpr[Tuple5[T1, T2, T3, T4, T5]]` */ given Tuple5ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr]: ToExpr[Tuple5[T1, T2, T3, T4, T5]] with { def apply(tup: Tuple5[T1, T2, T3, T4, T5])(using Quotes) = { val (x1, x2, x3, x4, x5) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}) } } } @@ -273,7 +273,7 @@ object ToExpr { given Tuple6ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr]: ToExpr[Tuple6[T1, T2, T3, T4, T5, T6]] with { def apply(tup: Tuple6[T1, T2, T3, T4, T5, T6])(using Quotes) = { val (x1, x2, x3, x4, x5, x6) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}) } } } @@ -281,7 +281,7 @@ object ToExpr { given Tuple7ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr]: ToExpr[Tuple7[T1, T2, T3, T4, T5, T6, T7]] with { def apply(tup: Tuple7[T1, T2, T3, T4, T5, T6, T7])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}) } } } @@ -289,7 +289,7 @@ object ToExpr { given Tuple8ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr]: ToExpr[Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]] with { def apply(tup: Tuple8[T1, T2, T3, T4, T5, T6, T7, T8])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}) } } } @@ -297,7 +297,7 @@ object ToExpr { given Tuple9ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr]: ToExpr[Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]] with { def apply(tup: Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}) } } } @@ -305,7 +305,7 @@ object ToExpr { given Tuple10ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr]: ToExpr[Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]] with { def apply(tup: Tuple10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}) } } } @@ -313,7 +313,7 @@ object ToExpr { given Tuple11ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr]: ToExpr[Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]] with { def apply(tup: Tuple11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}) } } } @@ -321,7 +321,7 @@ object ToExpr { given Tuple12ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr]: ToExpr[Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]] with { def apply(tup: Tuple12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}) } } } @@ -329,7 +329,7 @@ object ToExpr { given Tuple13ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr]: ToExpr[Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]] with { def apply(tup: Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}) } } } @@ -337,7 +337,7 @@ object ToExpr { given Tuple14ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr]: ToExpr[Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]] with { def apply(tup: Tuple14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}) } } } @@ -345,7 +345,7 @@ object ToExpr { given Tuple15ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr]: ToExpr[Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]] with { def apply(tup: Tuple15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}) } } } @@ -353,7 +353,7 @@ object ToExpr { given Tuple16ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr]: ToExpr[Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]] with { def apply(tup: Tuple16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}) } } } @@ -361,7 +361,7 @@ object ToExpr { given Tuple17ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr, T17: Type: ToExpr]: ToExpr[Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]] with { def apply(tup: Tuple17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}, ${Expr(x17)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}, ${Value(x17)}) } } } @@ -369,7 +369,7 @@ object ToExpr { given Tuple18ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr, T17: Type: ToExpr, T18: Type: ToExpr]: ToExpr[Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]] with { def apply(tup: Tuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}, ${Expr(x17)}, ${Expr(x18)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}, ${Value(x17)}, ${Value(x18)}) } } } @@ -377,7 +377,7 @@ object ToExpr { given Tuple19ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr, T17: Type: ToExpr, T18: Type: ToExpr, T19: Type: ToExpr]: ToExpr[Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]] with { def apply(tup: Tuple19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}, ${Expr(x17)}, ${Expr(x18)}, ${Expr(x19)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}, ${Value(x17)}, ${Value(x18)}, ${Value(x19)}) } } } @@ -385,7 +385,7 @@ object ToExpr { given Tuple20ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr, T17: Type: ToExpr, T18: Type: ToExpr, T19: Type: ToExpr, T20: Type: ToExpr]: ToExpr[Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]] with { def apply(tup: Tuple20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}, ${Expr(x17)}, ${Expr(x18)}, ${Expr(x19)}, ${Expr(x20)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}, ${Value(x17)}, ${Value(x18)}, ${Value(x19)}, ${Value(x20)}) } } } @@ -393,7 +393,7 @@ object ToExpr { given Tuple21ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr, T17: Type: ToExpr, T18: Type: ToExpr, T19: Type: ToExpr, T20: Type: ToExpr, T21: Type: ToExpr]: ToExpr[Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]] with { def apply(tup: Tuple21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}, ${Expr(x17)}, ${Expr(x18)}, ${Expr(x19)}, ${Expr(x20)}, ${Expr(x21)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}, ${Value(x17)}, ${Value(x18)}, ${Value(x19)}, ${Value(x20)}, ${Value(x21)}) } } } @@ -401,7 +401,7 @@ object ToExpr { given Tuple22ToExpr[T1: Type: ToExpr, T2: Type: ToExpr, T3: Type: ToExpr, T4: Type: ToExpr, T5: Type: ToExpr, T6: Type: ToExpr, T7: Type: ToExpr, T8: Type: ToExpr, T9: Type: ToExpr, T10: Type: ToExpr, T11: Type: ToExpr, T12: Type: ToExpr, T13: Type: ToExpr, T14: Type: ToExpr, T15: Type: ToExpr, T16: Type: ToExpr, T17: Type: ToExpr, T18: Type: ToExpr, T19: Type: ToExpr, T20: Type: ToExpr, T21: Type: ToExpr, T22: Type: ToExpr]: ToExpr[Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]] with { def apply(tup: Tuple22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22])(using Quotes) = { val (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22) = tup - '{ (${Expr(x1)}, ${Expr(x2)}, ${Expr(x3)}, ${Expr(x4)}, ${Expr(x5)}, ${Expr(x6)}, ${Expr(x7)}, ${Expr(x8)}, ${Expr(x9)}, ${Expr(x10)}, ${Expr(x11)}, ${Expr(x12)}, ${Expr(x13)}, ${Expr(x14)}, ${Expr(x15)}, ${Expr(x16)}, ${Expr(x17)}, ${Expr(x18)}, ${Expr(x19)}, ${Expr(x20)}, ${Expr(x21)}, ${Expr(x22)}) } + '{ (${Value(x1)}, ${Value(x2)}, ${Value(x3)}, ${Value(x4)}, ${Value(x5)}, ${Value(x6)}, ${Value(x7)}, ${Value(x8)}, ${Value(x9)}, ${Value(x10)}, ${Value(x11)}, ${Value(x12)}, ${Value(x13)}, ${Value(x14)}, ${Value(x15)}, ${Value(x16)}, ${Value(x17)}, ${Value(x18)}, ${Value(x19)}, ${Value(x20)}, ${Value(x21)}, ${Value(x22)}) } } } @@ -409,25 +409,25 @@ object ToExpr { given TupleConsToExpr [H: Type: ToExpr, T <: Tuple: Type: ToExpr]: ToExpr[H *: T] with { def apply(tup: H *: T)(using Quotes): Expr[H *: T] = '{ ${summon[ToExpr[H]].apply(tup.head)} *: ${summon[ToExpr[T]].apply(tup.tail)} } - // '{ ${Expr(tup.head)} *: ${Expr(tup.tail)} } // TODO figure out why this fails during CI documentation + // '{ ${Value(tup.head)} *: ${Value(tup.tail)} } // TODO figure out why this fails during CI documentation } /** Default implemetation of `ToExpr[BigInt]` */ given BigIntToExpr: ToExpr[BigInt] with { def apply(x: BigInt)(using Quotes): Expr[BigInt] = - '{ BigInt(${Expr(x.toByteArray)}) } + '{ BigInt(${Value(x.toByteArray)}) } } /** Default implemetation of `ToExpr[BigDecimal using the default MathContext]` */ given BigDecimalToExpr: ToExpr[BigDecimal] with { def apply(x: BigDecimal)(using Quotes): Expr[BigDecimal] = - '{ BigDecimal(${Expr(x.toString)}) } + '{ BigDecimal(${Value(x.toString)}) } } /** Default implemetation of `ToExpr[StringContext]` */ given StringContextToExpr: ToExpr[StringContext] with { def apply(stringContext: StringContext)(using Quotes): Expr[StringContext] = - val parts = Varargs(stringContext.parts.map(Expr(_))) + val parts = Varargs(stringContext.parts.map(Value(_))) '{ StringContext($parts: _*) } } diff --git a/library/src-non-bootstrapped/scala/quoted/ToExpr.scala b/library/src-non-bootstrapped/scala/quoted/ToExpr.scala new file mode 100644 index 000000000000..ae1cb7b5402a --- /dev/null +++ b/library/src-non-bootstrapped/scala/quoted/ToExpr.scala @@ -0,0 +1,4 @@ +package scala.quoted + +trait ToExpr[T]: + def apply(x: T)(using Quotes): Expr[T] diff --git a/library/src/scala/quoted/Const.scala b/library/src/scala/quoted/Const.scala index 2b19792e127d..727f7cd8bd4d 100644 --- a/library/src/scala/quoted/Const.scala +++ b/library/src/scala/quoted/Const.scala @@ -1,6 +1,7 @@ package scala.quoted /** Literal constant values */ +@deprecated("Use `scala.quoted.Value` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") object Const { /** Matches expressions containing literal constant values and extracts the value. @@ -18,6 +19,7 @@ object Const { * * To directly unlift an expression `expr: Expr[T]` consider using `expr.value`/`expr.valueOrError` insead. */ + @deprecated("Use `scala.quoted.Value.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") def unapply[T](expr: Expr[T])(using Quotes): Option[T] = { import quotes.reflect._ def rec(tree: Term): Option[T] = tree match { diff --git a/library/src/scala/quoted/Consts.scala b/library/src/scala/quoted/Consts.scala index 5b2708185412..44c84dc951f6 100644 --- a/library/src/scala/quoted/Consts.scala +++ b/library/src/scala/quoted/Consts.scala @@ -1,6 +1,7 @@ package scala.quoted /** Literal constant values */ +@deprecated("Use `scala.quoted.Values` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") object Consts { /** Matches literal sequence of literal constant value expressions and return a sequence of values. @@ -17,6 +18,7 @@ object Consts { * * To directly unlift all expressions in a sequence `exprs: Seq[Expr[T]]` consider using `exprs.map(_.value)`/`exprs.map(_.valueOrError)` insead. */ + @deprecated("Use `scala.quoted.Values.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") def unapply[T](exprs: Seq[Expr[T]])(using Quotes): Option[Seq[T]] = exprs.foldRight(Option(List.empty[T])) { (elem, acc) => (elem, acc) match { diff --git a/library/src/scala/quoted/Quotes.scala b/library/src/scala/quoted/Quotes.scala index 1766821f589e..7ad3e0b68c3b 100644 --- a/library/src/scala/quoted/Quotes.scala +++ b/library/src/scala/quoted/Quotes.scala @@ -33,6 +33,12 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching => */ def matches(that: Expr[Any]): Boolean + @deprecated("Use `.value` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") + def unlift(using FromExpr[T]): Option[T] = self.value + + @deprecated("Use `.value` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") + def unliftOrError(using FromExpr[T]): T = self.valueOrError + /** Return the value of this expression. * * Returns `None` if the expression does not represent a value or possibly contains side effects. diff --git a/library/src/scala/quoted/Unlifted.scala b/library/src/scala/quoted/Unlifted.scala new file mode 100644 index 000000000000..c21e9892d97f --- /dev/null +++ b/library/src/scala/quoted/Unlifted.scala @@ -0,0 +1,14 @@ +package scala.quoted + +@deprecated("Use `scala.quoted.Values` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") +object Unlifted: + + @deprecated("Use `scala.quoted.Values.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") + def apply[T](expr: Expr[T])(using FromExpr[T])(using Quotes): Option[T] = + Value.unapply(expr) + + @deprecated("Use `scala.quoted.Values.unapply` instead. This will be removed in 3.0.0-RC1", "3.0.0-M3") + def unapply[T](exprs: Seq[Expr[T]])(using FromExpr[T])(using Quotes): Option[Seq[T]] = + Values.unapply(exprs) + +end Unlifted diff --git a/library/src/scala/quoted/Value.scala b/library/src/scala/quoted/Value.scala new file mode 100644 index 000000000000..6fcfa8be7fc7 --- /dev/null +++ b/library/src/scala/quoted/Value.scala @@ -0,0 +1,25 @@ +package scala.quoted + +/** Constructors for expressions */ +object Value: + + /** Creates an expression that will construct the value `x` */ + def apply[T](x: T)(using ToExpr[T])(using Quotes): Expr[T] = + scala.Predef.summon[ToExpr[T]].apply(x) + + /** Get `Some` of a copy of the value if the expression contains a literal constant or constructor of `T`. + * Otherwise returns `None`. + * + * Usage: + * ``` + * case '{ ... ${expr @ Value(value)}: T ...} => + * // expr: Expr[T] + * // value: T + * ``` + * + * To directly get the value of an expression `expr: Expr[T]` consider using `expr.value`/`expr.valueOrError` insead. + */ + def unapply[T](x: Expr[T])(using FromExpr[T])(using Quotes): Option[T] = + scala.Predef.summon[FromExpr[T]].unapply(x) + +end Value diff --git a/library/src/scala/quoted/Exprs.scala b/library/src/scala/quoted/Values.scala similarity index 89% rename from library/src/scala/quoted/Exprs.scala rename to library/src/scala/quoted/Values.scala index 7e71ab411055..49520f31ce86 100644 --- a/library/src/scala/quoted/Exprs.scala +++ b/library/src/scala/quoted/Values.scala @@ -1,6 +1,6 @@ package scala.quoted -object Exprs: +object Values: /** Matches literal sequence of literal constant value expressions and return a sequence of values. * @@ -8,8 +8,7 @@ object Exprs: * ```scala * inline def sum(args: Int*): Int = ${ sumExpr('args) } * def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes): Expr[Int] = argsExpr match - * case Varargs(Exprs(args)) => - * case Varargs(Exprs(args)) => + * case Varargs(Values(args)) => * // args: Seq[Int] * ... * } @@ -25,4 +24,4 @@ object Exprs: case _ => return None Some(builder.result()) -end Exprs +end Values diff --git a/tests/bench/string-interpolation-macro/Macro.scala b/tests/bench/string-interpolation-macro/Macro.scala index 9b2f2f208108..968addcbe1b8 100644 --- a/tests/bench/string-interpolation-macro/Macro.scala +++ b/tests/bench/string-interpolation-macro/Macro.scala @@ -10,7 +10,7 @@ object Macro { for _ <- 0 to 5_000 do (strCtxExpr, argsExpr) match { case ('{ StringContext(${Varargs(Consts(parts))}: _*) }, Varargs(Consts(args))) => - res = Expr(StringContext(parts: _*).s(args: _*)) + res = Value(StringContext(parts: _*).s(args: _*)) case _ => ??? } res diff --git a/tests/disabled/not-representable/pos/annotated-treecopy/Impls_Macros_1.scala b/tests/disabled/not-representable/pos/annotated-treecopy/Impls_Macros_1.scala index 00ddb5314a95..7b4aac4db49f 100644 --- a/tests/disabled/not-representable/pos/annotated-treecopy/Impls_Macros_1.scala +++ b/tests/disabled/not-representable/pos/annotated-treecopy/Impls_Macros_1.scala @@ -18,7 +18,7 @@ object Macros { import internal._ val ttag = c.weakTypeTag[U] f match { - case Expr(Function(List(ValDef(_,n,tp,_)),b)) => + case Value(Function(List(ValDef(_,n,tp,_)),b)) => // normalize argument name var b1 = new Transformer { override def transform(tree: Tree): Tree = tree match { diff --git a/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala b/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala index 329e32a9c910..f18d2a276750 100644 --- a/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala +++ b/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala @@ -9,7 +9,7 @@ object Test { val y = 1 ${ inline def a(z: Int): Int = ${ impl('z) } - val b = Expr(a(7)) + val b = Value(a(7)) '{ y + $b } } } diff --git a/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala b/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala index a1ecc31b776e..5ec1c8544cca 100644 --- a/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala +++ b/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala @@ -9,7 +9,7 @@ object BigFloatFromDigitsImpl: case Some(ds) => try val BigFloat(m, e) = BigFloat(ds) - '{BigFloat(${Expr(m)}, ${Expr(e)})} + '{BigFloat(${Value(m)}, ${Value(e)})} catch case ex: FromDigits.FromDigitsException => quotes.reflect.report.error(ex.getMessage) '{BigFloat(0, 0)} diff --git a/tests/neg-macros/BigFloat/BigFloat_1.scala b/tests/neg-macros/BigFloat/BigFloat_1.scala index 4d256f4394d8..9251d629b513 100644 --- a/tests/neg-macros/BigFloat/BigFloat_1.scala +++ b/tests/neg-macros/BigFloat/BigFloat_1.scala @@ -45,7 +45,7 @@ object BigFloat extends App { given ToExpr[BigInt] with { def apply(x: BigInt)(using Quotes) = - '{BigInt(${Expr(x.toString)})} + '{BigInt(${Value(x.toString)})} } } diff --git a/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala b/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala index 1d2e484daa5d..43619aa4dc21 100644 --- a/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala +++ b/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala @@ -13,7 +13,7 @@ object EvenFromDigitsImpl: quotes.reflect.report.error(ex.getMessage) Even(0) } - '{Even(${Expr(ev.n)})} + '{Even(${Value(ev.n)})} case _ => '{evenFromDigits($digits)} } diff --git a/tests/neg-macros/i5547.scala b/tests/neg-macros/i5547.scala index 0f895e65d779..a724ef6872d9 100644 --- a/tests/neg-macros/i5547.scala +++ b/tests/neg-macros/i5547.scala @@ -2,7 +2,7 @@ import scala.quoted._ object scalatest { inline def assert2(condition: => Boolean): Unit = - ${ assertImpl('condition, Expr("")) } // error + ${ assertImpl('condition, Value("")) } // error def assertImpl(condition: Expr[Boolean], clue: Expr[Any])(using Quotes): Expr[Unit] = '{} diff --git a/tests/neg-macros/i6762.scala b/tests/neg-macros/i6762.scala index c5f1fb7c86b3..bd3e82d90588 100644 --- a/tests/neg-macros/i6762.scala +++ b/tests/neg-macros/i6762.scala @@ -2,4 +2,4 @@ import scala.quoted._ type G[X] case class Foo[T](x: T) -def f(word: String)(using Quotes): Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error +def f(word: String)(using Quotes): Expr[Foo[G[String]]] = '{Foo(${Value(word)})} // error // error diff --git a/tests/neg-macros/i7618.scala b/tests/neg-macros/i7618.scala index 3c28caf68564..0874555cf801 100644 --- a/tests/neg-macros/i7618.scala +++ b/tests/neg-macros/i7618.scala @@ -14,7 +14,7 @@ object Compiler { inline def compile(e: Exp, env: Map[String, Expr[Int]])(using ctx: Quotes): Expr[Int] = inline e match { case Num(n) => - Expr(n) + Value(n) case Plus(e1, e2) => '{ ${ compile(e1, env) } + ${ compile(e2, env) } } case Var(x) => diff --git a/tests/neg-macros/i7618b.scala b/tests/neg-macros/i7618b.scala index 817618a54810..102b500216cd 100644 --- a/tests/neg-macros/i7618b.scala +++ b/tests/neg-macros/i7618b.scala @@ -14,7 +14,7 @@ object Compiler { inline def compile(e: Exp, env: Map[String, Expr[Int]])(using ctx: Quotes): Expr[Int] = inline e match { case Num(n) => - Expr(n) + Value(n) case Plus(e1, e2) => '{ ${ compile(e1, env) } + ${ compile(e2, env) } } case Var(x) => diff --git a/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala b/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala index 6aa873114fa2..1d31f861ae0d 100644 --- a/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala +++ b/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala @@ -26,7 +26,7 @@ trait E[T] { } case class I(n: Int) extends E[Int] { - def lift (using Quotes): Expr[Int] = Expr(n) + def lift (using Quotes): Expr[Int] = Value(n) } case class Plus[T](x: E[T], y: E[T])(implicit op: Plus2[T]) extends E[T] { diff --git a/tests/neg-macros/inline-option/Macro_1.scala b/tests/neg-macros/inline-option/Macro_1.scala index 53754d5629ce..94c1dcb00602 100644 --- a/tests/neg-macros/inline-option/Macro_1.scala +++ b/tests/neg-macros/inline-option/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Macro { def impl(opt: Expr[Option[Int]]) (using Quotes): Expr[Int] = opt.valueOrError match { - case Some(i) => Expr(i) + case Some(i) => Value(i) case None => '{-1} } } \ No newline at end of file diff --git a/tests/neg-macros/inline-tuples-1/Macro_1.scala b/tests/neg-macros/inline-tuples-1/Macro_1.scala index 76ba8fcb0dc0..1e7045d18ad9 100644 --- a/tests/neg-macros/inline-tuples-1/Macro_1.scala +++ b/tests/neg-macros/inline-tuples-1/Macro_1.scala @@ -2,26 +2,26 @@ import scala.quoted._ object Macros { - def tup1(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup2(tup: Expr[Tuple2[Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup1(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup2(tup: Expr[Tuple2[Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) } diff --git a/tests/neg-macros/quote-interpolator-core-old.scala b/tests/neg-macros/quote-interpolator-core-old.scala index bb99ff40b180..cee2acd7bb9e 100644 --- a/tests/neg-macros/quote-interpolator-core-old.scala +++ b/tests/neg-macros/quote-interpolator-core-old.scala @@ -17,7 +17,7 @@ object FInterpolation { } def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(using Quotes): Expr[String] = { - val str: Expr[String] = Expr(sc.parts.mkString("")) + val str: Expr[String] = Value(sc.parts.mkString("")) val args1: Expr[Seq[Any]] = liftSeq(args) '{ $str.format($args1: _*) } } diff --git a/tests/neg-macros/quote-macro-complex-arg-0.scala b/tests/neg-macros/quote-macro-complex-arg-0.scala index da11de825897..b918ab902ab5 100644 --- a/tests/neg-macros/quote-macro-complex-arg-0.scala +++ b/tests/neg-macros/quote-macro-complex-arg-0.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macros { inline def foo(inline i: Int, dummy: Int, j: Int): Int = ${ bar(i + 1, 'j) } // error: i + 1 is not a parameter or field reference - def bar(x: Int, y: Expr[Int])(using Quotes): Expr[Int] = '{ ${Expr(x)} + $y } + def bar(x: Int, y: Expr[Int])(using Quotes): Expr[Int] = '{ ${Value(x)} + $y } } diff --git a/tests/neg-macros/reflect-inline/assert_1.scala b/tests/neg-macros/reflect-inline/assert_1.scala index 32abbfe3ea17..f2d750e89b5e 100644 --- a/tests/neg-macros/reflect-inline/assert_1.scala +++ b/tests/neg-macros/reflect-inline/assert_1.scala @@ -5,6 +5,6 @@ object api { ${ stripImpl('x) } private def stripImpl(x: Expr[String])(using Quotes): Expr[String] = - Expr(x.valueOrError.stripMargin) + Value(x.valueOrError.stripMargin) } diff --git a/tests/neg-macros/splice-in-top-level-splice-1.scala b/tests/neg-macros/splice-in-top-level-splice-1.scala index 63c503caeeb3..4498ddf9757c 100644 --- a/tests/neg-macros/splice-in-top-level-splice-1.scala +++ b/tests/neg-macros/splice-in-top-level-splice-1.scala @@ -3,5 +3,5 @@ import scala.quoted._ object Foo { inline def foo(): Int = ${bar(${x})} // error def x(using Quotes): Expr[Int] = '{1} - def bar(i: Int)(using Quotes): Expr[Int] = Expr(i) + def bar(i: Int)(using Quotes): Expr[Int] = Value(i) } diff --git a/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala b/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala index 56038ab2b3aa..e75218b3bf48 100644 --- a/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala +++ b/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala @@ -7,6 +7,6 @@ object Macros { inline def foo(i: => Int): Int = ${ fooImpl('i) } def fooImpl(i: Expr[Int])(using Quotes): Expr[Int] = { val y: Int = run(i) - Expr(y) + Value(y) } } diff --git a/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala b/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala index 22fb66a3f2d1..54d9af8c22b6 100644 --- a/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala +++ b/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala @@ -13,7 +13,7 @@ object EvenFromDigitsImpl: quotes.reflect.report.error(ex.getMessage) Even(0) } - '{Even(${Expr(ev.n)})} + '{Even(${Value(ev.n)})} case _ => '{evenFromDigits($digits)} } diff --git a/tests/pending/pos/i4987.scala b/tests/pending/pos/i4987.scala index f00e67585c6b..5b24358be062 100644 --- a/tests/pending/pos/i4987.scala +++ b/tests/pending/pos/i4987.scala @@ -12,6 +12,6 @@ object Foo { implicit def NilIsLiftable: Liftable[Nil.type] = ??? - Expr(Nil)(using NilIsLiftable) - Expr(Nil) + Value(Nil)(using NilIsLiftable) + Value(Nil) } \ No newline at end of file diff --git a/tests/pos-macros/f64Pow5Split/Macro.scala b/tests/pos-macros/f64Pow5Split/Macro.scala index 0e9fd5e84616..ecf84c6977cf 100644 --- a/tests/pos-macros/f64Pow5Split/Macro.scala +++ b/tests/pos-macros/f64Pow5Split/Macro.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Macro { inline def f64Pow5Split: Array[Long] = ${ f64Pow5SplitExpr } - private def f64Pow5SplitExpr(using Quotes): Expr[Array[Long]] = Expr { + private def f64Pow5SplitExpr(using Quotes): Expr[Array[Long]] = Value { val ss = new Array[Long](652) var pow5 = BigInt(1) var i = 0 diff --git a/tests/pos-macros/i10107b/Macro_1.scala b/tests/pos-macros/i10107b/Macro_1.scala index 6fecabf4d1a6..c3bf32f5f6de 100644 --- a/tests/pos-macros/i10107b/Macro_1.scala +++ b/tests/pos-macros/i10107b/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def isTrue: Boolean = ${ isTrueImpl } def isTrueImpl(using Quotes) = { - Expr(true) + Value(true) } inline def oneOf(): String = { diff --git a/tests/pos-macros/i6214.scala b/tests/pos-macros/i6214.scala index beb394a70950..dad8783080d3 100644 --- a/tests/pos-macros/i6214.scala +++ b/tests/pos-macros/i6214.scala @@ -2,6 +2,6 @@ import scala.quoted._ object Test { def res(x: quoted.Expr[Int])(using Quotes): quoted.Expr[Int] = x match { case '{ val a: Int = $y; 1} => y // owner of `y` is `res` - case _ => '{ val b: Int = ${val c = 2; Expr(c)}; 1} // owner of `c` is `b`, but that seems to be OK + case _ => '{ val b: Int = ${val c = 2; Value(c)}; 1} // owner of `c` is `b`, but that seems to be OK } } \ No newline at end of file diff --git a/tests/pos-macros/i6803b/Macro_1.scala b/tests/pos-macros/i6803b/Macro_1.scala index f533e360b248..952cadf0ca1a 100644 --- a/tests/pos-macros/i6803b/Macro_1.scala +++ b/tests/pos-macros/i6803b/Macro_1.scala @@ -10,7 +10,7 @@ object AsObject { inline given x: LineNo = ${impl} private def impl(using Quotes) : Expr[LineNo] = { import quotes.reflect._ - '{unsafe(${Expr(Position.ofMacroExpansion.startLine)})} + '{unsafe(${Value(Position.ofMacroExpansion.startLine)})} } } } diff --git a/tests/pos-macros/i8521/Macro_1.scala b/tests/pos-macros/i8521/Macro_1.scala index 63aed53debb9..f68ab45adee4 100644 --- a/tests/pos-macros/i8521/Macro_1.scala +++ b/tests/pos-macros/i8521/Macro_1.scala @@ -21,6 +21,6 @@ object Foo { } } } - Expr("") + Value("") } } diff --git a/tests/pos-macros/i9240/Macro_1.scala b/tests/pos-macros/i9240/Macro_1.scala index 1323e016e9a8..90b1a58e537f 100644 --- a/tests/pos-macros/i9240/Macro_1.scala +++ b/tests/pos-macros/i9240/Macro_1.scala @@ -4,7 +4,7 @@ inline def diveInto[T]: String = ${ diveIntoImpl[T]() } def diveIntoImpl[T]()(implicit qctx: Quotes, ttype: Type[T]): Expr[String] = import quotes.reflect._ - Expr( unwindType(TypeRepr.of[T]) ) + Value( unwindType(TypeRepr.of[T]) ) def unwindType(using Quotes)(aType: quotes.reflect.TypeRepr): String = import quotes.reflect._ @@ -20,4 +20,3 @@ def unwindType(using Quotes)(aType: quotes.reflect.TypeRepr): String = case _ => } "OK!" - diff --git a/tests/pos-macros/i9251/Macro_1.scala b/tests/pos-macros/i9251/Macro_1.scala index c6ac626f08b8..081e0ac81581 100644 --- a/tests/pos-macros/i9251/Macro_1.scala +++ b/tests/pos-macros/i9251/Macro_1.scala @@ -29,6 +29,6 @@ object Async { val fType = TypeRepr.of[F] val ptp = tparams1.tail.head val ptpTree = Inferred(fType.appliedTo(ptp)) - '{ println(${Expr(ptpTree.show)}) } + '{ println(${Value(ptpTree.show)}) } } diff --git a/tests/pos-macros/i9484/C.scala b/tests/pos-macros/i9484/C.scala index e4c6185c705d..507c9a654440 100644 --- a/tests/pos-macros/i9484/C.scala +++ b/tests/pos-macros/i9484/C.scala @@ -2,5 +2,5 @@ import scala.quoted._ object C { inline def m: Any = ${ mExpr } - def mExpr(using Quotes): Expr[Any] = Expr(1) + def mExpr(using Quotes): Expr[Any] = Value(1) } diff --git a/tests/pos-macros/i9484/Q.scala b/tests/pos-macros/i9484/Q.scala index 411ca6bca67a..ecc6f4616793 100644 --- a/tests/pos-macros/i9484/Q.scala +++ b/tests/pos-macros/i9484/Q.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Q { inline def f(): Any = ${ fExpr } - def fExpr(using Quotes): Expr[Any] = { new LC; Expr(1) } + def fExpr(using Quotes): Expr[Any] = { new LC; Value(1) } } \ No newline at end of file diff --git a/tests/pos-macros/i9570.scala b/tests/pos-macros/i9570.scala index 90d3aa85081f..b91c318f37af 100644 --- a/tests/pos-macros/i9570.scala +++ b/tests/pos-macros/i9570.scala @@ -12,7 +12,7 @@ object Macros { e match { case '{HCons(_,$t)} => // error if run with fatal warinings in BootstrappedOnlyCompilationTests sizeImpl(t,n+1) - case '{HNil} => Expr(n) + case '{HNil} => Value(n) } } diff --git a/tests/pos-macros/macro-docs.scala b/tests/pos-macros/macro-docs.scala index 8d741ff07e06..5d66e1c1dec8 100644 --- a/tests/pos-macros/macro-docs.scala +++ b/tests/pos-macros/macro-docs.scala @@ -19,14 +19,14 @@ object MacrosMD_ToExpr { given [T: ToExpr : Type]: ToExpr[List[T]] with { def apply(xs: List[T])(using Quotes) = xs match { - case head :: tail => '{ ${ Expr(head) } :: ${ apply(tail) } } + case head :: tail => '{ ${ Value(head) } :: ${ apply(tail) } } case Nil => '{ Nil: List[T] } } } def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = { val code: String = expr.show - Expr(code) + Value(code) } } diff --git a/tests/pos-macros/quote-lift.scala b/tests/pos-macros/quote-lift.scala index 92dd80ef1941..6aac52dc98f8 100644 --- a/tests/pos-macros/quote-lift.scala +++ b/tests/pos-macros/quote-lift.scala @@ -9,7 +9,7 @@ class Test(using Quotes) { '{ ${summon[ToExpr[Int]].apply(1)} } - '{ ${Expr(1)} } + '{ ${Value(1)} } } diff --git a/tests/pos-macros/quote-liftable.scala b/tests/pos-macros/quote-liftable.scala index 034a13c51f6a..3bf0e3812a97 100644 --- a/tests/pos-macros/quote-liftable.scala +++ b/tests/pos-macros/quote-liftable.scala @@ -21,21 +21,21 @@ def test(using Quotes) = { implicit def ListToExpr[T: ToExpr: Type]: ToExpr[List[T]] = new { def apply(xs: List[T])(using Quotes) = xs match { - case x :: xs1 => '{ ${ Expr(x) } :: ${ apply(xs1) } } + case x :: xs1 => '{ ${ Value(x) } :: ${ apply(xs1) } } case Nil => '{Nil: List[T]} } } - Expr(true) - Expr(1) - Expr('a') - Expr(1) - Expr(1) - Expr(1L) - Expr(1.0f) - Expr(1.0) - Expr("abc") - Expr(StringContext("a", "b", "c")) + Value(true) + Value(1) + Value('a') + Value(1) + Value(1) + Value(1L) + Value(1.0f) + Value(1.0) + Value("abc") + Value(StringContext("a", "b", "c")) - val xs: Expr[List[Int]] = Expr(1 :: 2 :: 3 :: Nil) + val xs: Expr[List[Int]] = Value(1 :: 2 :: 3 :: Nil) } diff --git a/tests/pos-macros/quote-whitebox-2/Macro_1.scala b/tests/pos-macros/quote-whitebox-2/Macro_1.scala index 351f6c1216ba..afbe85e1b466 100644 --- a/tests/pos-macros/quote-whitebox-2/Macro_1.scala +++ b/tests/pos-macros/quote-whitebox-2/Macro_1.scala @@ -7,6 +7,6 @@ object Macro { def impl(strExpr: Expr[String]) (using Quotes)= val str = strExpr.valueOrError - if (str.length == 1) Expr(str.charAt(0)) else Expr(str) + if (str.length == 1) Value(str.charAt(0)) else Value(str) } diff --git a/tests/pos-macros/scala2-macro-compat-1.scala b/tests/pos-macros/scala2-macro-compat-1.scala index 63a9d0d6c43e..862b5ee5101f 100644 --- a/tests/pos-macros/scala2-macro-compat-1.scala +++ b/tests/pos-macros/scala2-macro-compat-1.scala @@ -21,6 +21,6 @@ object LineNumberMacro3 { import scala.quoted._ def thisLineNumberExpr(using Quotes): Expr[Int] = { import quotes.reflect._ - Expr(Position.ofMacroExpansion.startLine + 1) + Value(Position.ofMacroExpansion.startLine + 1) } } diff --git a/tests/pos-staging/quote-0.scala b/tests/pos-staging/quote-0.scala index e999bf127a02..0096aa046ed2 100644 --- a/tests/pos-staging/quote-0.scala +++ b/tests/pos-staging/quote-0.scala @@ -11,7 +11,7 @@ object Macros { '{ if !($expr) then throw new AssertionError(s"failed assertion: ${${showExpr(expr)}}") } - def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = Expr(expr.toString) + def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = Value(expr.toString) inline def power(inline n: Int, x: Double) = ${ powerCode('n, 'x) } diff --git a/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala b/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala index c8e2ac2b8e52..c672004d2cec 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala @@ -8,8 +8,8 @@ object Foo { def inspectBodyImpl(x: Expr[Int])(using Quotes) : Expr[String] = { import quotes.reflect._ Term.of(x) match { - case Inlined(None, Nil, arg) => Expr(arg.symbol.tree.showExtractors) - case arg => Expr(arg.symbol.tree.showExtractors) // TODO should all by name parameters be in an inline node? + case Inlined(None, Nil, arg) => Value(arg.symbol.tree.showExtractors) + case arg => Value(arg.symbol.tree.showExtractors) // TODO should all by name parameters be in an inline node? } } diff --git a/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala b/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala index 379e5d798390..4871c3d35d60 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala @@ -8,8 +8,8 @@ object Foo { def inspectBodyImpl(x: Expr[Int])(using Quotes) : Expr[String] = { import quotes.reflect._ Term.of(x) match { - case Inlined(None, Nil, arg) => Expr(arg.symbol.tree.showExtractors) - case arg => Expr(arg.symbol.tree.showExtractors) // TODO should all by name parameters be in an inline node? + case Inlined(None, Nil, arg) => Value(arg.symbol.tree.showExtractors) + case arg => Value(arg.symbol.tree.showExtractors) // TODO should all by name parameters be in an inline node? } } } diff --git a/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala index 09054f8a5a5e..3f1e04a04c20 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala @@ -14,7 +14,7 @@ object Macros { val tree = Term.of(x) output.traverseTree(tree)(Symbol.spliceOwner) - '{print(${Expr(buff.result())})} + '{print(${Value(buff.result())})} } diff --git a/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala index 424a60ff506f..ab76b1019d6d 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala @@ -10,7 +10,7 @@ object Foo { import quotes.reflect._ def definitionString(sym: Symbol): Expr[String] = - if sym.isClassDef || sym.isDefDef || sym.isValDef then Expr(sym.tree.showExtractors) + if sym.isClassDef || sym.isDefDef || sym.isValDef then Value(sym.tree.showExtractors) else '{"NO DEFINTION"} Term.of(x) match { diff --git a/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala index 7e567cca9de3..fb9f2ccd380f 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala @@ -9,7 +9,7 @@ object Foo { import quotes.reflect._ def definitionString(sym: Symbol): Expr[String] = - if sym.isClassDef || sym.isDefDef || sym.isValDef then Expr(sym.tree.showExtractors) + if sym.isClassDef || sym.isDefDef || sym.isValDef then Value(sym.tree.showExtractors) else '{"NO DEFINTION"} Term.of(x) match { diff --git a/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala b/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala index 3bc306b73b10..26787f5d4169 100644 --- a/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala +++ b/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala @@ -5,7 +5,7 @@ inline def isFunctionType[T]: Boolean = ${ isFunctionTypeImpl[T] } def isFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[T].isFunctionType) + Value(TypeRepr.of[T].isFunctionType) } @@ -13,7 +13,7 @@ inline def isContextFunctionType[T]: Boolean = ${ isContextFunctionTypeImpl[T] } def isContextFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[T].isContextFunctionType) + Value(TypeRepr.of[T].isContextFunctionType) } @@ -21,13 +21,13 @@ inline def isErasedFunctionType[T]: Boolean = ${ isErasedFunctionTypeImpl[T] } def isErasedFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[T].isErasedFunctionType) + Value(TypeRepr.of[T].isErasedFunctionType) } inline def isDependentFunctionType[T]: Boolean = ${ isDependentFunctionTypeImpl[T] } def isDependentFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[T].isDependentFunctionType) + Value(TypeRepr.of[T].isDependentFunctionType) } diff --git a/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala b/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala index d77cf6334f2f..fd4d666596ef 100644 --- a/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala +++ b/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala @@ -9,7 +9,7 @@ object BigFloatFromDigitsImpl: case Some(ds) => try val BigFloat(m, e) = BigFloat(ds) - '{BigFloat(${Expr(m)}, ${Expr(e)})} + '{BigFloat(${Value(m)}, ${Value(e)})} catch case ex: FromDigits.FromDigitsException => import quotes.reflect.report report.error(ex.getMessage) diff --git a/tests/run-macros/BigFloat/BigFloat_1.scala b/tests/run-macros/BigFloat/BigFloat_1.scala index 4d256f4394d8..9251d629b513 100644 --- a/tests/run-macros/BigFloat/BigFloat_1.scala +++ b/tests/run-macros/BigFloat/BigFloat_1.scala @@ -45,7 +45,7 @@ object BigFloat extends App { given ToExpr[BigInt] with { def apply(x: BigInt)(using Quotes) = - '{BigInt(${Expr(x.toString)})} + '{BigInt(${Value(x.toString)})} } } diff --git a/tests/run-macros/enum-nat-macro/Macros_2.scala b/tests/run-macros/enum-nat-macro/Macros_2.scala index 19339ef403e8..ff2866122134 100644 --- a/tests/run-macros/enum-nat-macro/Macros_2.scala +++ b/tests/run-macros/enum-nat-macro/Macros_2.scala @@ -13,7 +13,7 @@ import Nat._ case '{ Succ($nat) } => inner(nat, acc + 1) case '{ Zero } => acc - Expr(inner(nat, 0)) + Value(inner(nat, 0)) def natZero(using Quotes): Expr[Nat.Zero.type] = '{Zero} diff --git a/tests/run-macros/exports/Macro_2.scala b/tests/run-macros/exports/Macro_2.scala index 596f611f36dc..d0e45adf59e8 100644 --- a/tests/run-macros/exports/Macro_2.scala +++ b/tests/run-macros/exports/Macro_2.scala @@ -18,11 +18,11 @@ private def visitExportsTreeMapImpl[T: Type](e: Expr[T], f: Expr[T => Any])(usin private def visitExportsShowImpl[T: Type](e: Expr[T])(using Quotes): Expr[Any] = import quotes.reflect._ - '{println(${Expr(Term.of(e).show)})} + '{println(${Value(Term.of(e).show)})} private def visitExportsShowExtractImpl[T: Type](e: Expr[T])(using Quotes): Expr[Any] = import quotes.reflect._ - '{println(${Expr(Term.of(e).showExtractors)})} + '{println(${Value(Term.of(e).showExtractors)})} private object IdempotentExprMap extends ExprMap { @@ -45,7 +45,7 @@ private def traverseExportsImpl(e: Expr[Any], f: Expr[String => Any])(using Quot val res = ExportAccumulator.foldTree(mutable.Buffer.empty, Term.of(e))(Symbol.spliceOwner).mkString(", ") - '{ $f(${Expr(res)}) } + '{ $f(${Value(res)}) } } private def mixinLoggerImpl(l: Expr[Logger])(using Quotes): Expr[Logger] = diff --git a/tests/run-macros/expr-map-1/Macro_1.scala b/tests/run-macros/expr-map-1/Macro_1.scala index 660ba1588264..600356b3c0a5 100644 --- a/tests/run-macros/expr-map-1/Macro_1.scala +++ b/tests/run-macros/expr-map-1/Macro_1.scala @@ -10,7 +10,7 @@ private object StringRewriter extends ExprMap { def transform[T](e: Expr[T])(using Type[T])(using Quotes): Expr[T] = e match case Const(s: String) => - Expr(s.reverse) match + Value(s.reverse) match case '{ $x: T } => x case _ => e // e had a singlton String type case _ => transformChildren(e) diff --git a/tests/run-macros/expr-map-3/Macro_1.scala b/tests/run-macros/expr-map-3/Macro_1.scala index 4ca27b8ace5e..f507dc51d606 100644 --- a/tests/run-macros/expr-map-3/Macro_1.scala +++ b/tests/run-macros/expr-map-3/Macro_1.scala @@ -9,10 +9,10 @@ private def stringRewriter(e: Expr[Any])(using Quotes): Expr[Any] = private object StringRewriter extends ExprMap { def transform[T](e: Expr[T])(using Type[T])(using Quotes): Expr[T] = e match - case '{ ${Expr(s)}: String } => + case '{ ${Value(s)}: String } => // checkIfValid(s) val s2: String & T = s - Expr(s2) + Value(s2) case _ => transformChildren(e) } diff --git a/tests/run-macros/f-interpolation-1/FQuote_1.scala b/tests/run-macros/f-interpolation-1/FQuote_1.scala index 6f3b0de216aa..64d51f5d90bd 100644 --- a/tests/run-macros/f-interpolation-1/FQuote_1.scala +++ b/tests/run-macros/f-interpolation-1/FQuote_1.scala @@ -47,12 +47,12 @@ object FQuote { for ((arg, part) <- allArgs.zip(parts.tail)) { if (part.startsWith("%d") && !(arg.tpe <:< TypeRepr.of[Int])) { - return '{s"`${${Expr(arg.show)}}` is not of type Int"} + return '{s"`${${Value(arg.show)}}` is not of type Int"} } } val string = parts.mkString("") - '{ new collection.immutable.StringOps(${Expr(string)}).format($args: _*) } + '{ new collection.immutable.StringOps(${Value(string)}).format($args: _*) } } } diff --git a/tests/run-macros/flops-rewrite-2/Macro_1.scala b/tests/run-macros/flops-rewrite-2/Macro_1.scala index 8c6a0f49ecc0..27253e098f98 100644 --- a/tests/run-macros/flops-rewrite-2/Macro_1.scala +++ b/tests/run-macros/flops-rewrite-2/Macro_1.scala @@ -14,7 +14,7 @@ private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { case '{ plus($x, $y) } => (x.value, y.value) match { case (Some(0), _) => y - case (Some(a), Some(b)) => Expr(a + b) + case (Some(a), Some(b)) => Value(a + b) case (_, Some(_)) => '{ $y + $x } case _ => '{ $x + $y } } @@ -22,15 +22,15 @@ private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { (x.value, y.value) match { case (Some(0), _) => '{0} case (Some(1), _) => y - case (Some(a), Some(b)) => Expr(a * b) + case (Some(a), Some(b)) => Value(a * b) case (_, Some(_)) => '{ $y * $x } case _ => '{ $x * $y } } case '{ power(${Const(x)}, ${Const(y)}) } => - Expr(power(x, y)) + Value(power(x, y)) case '{ power($x, ${Const(y)}) } => if y == 0 then '{1} - else '{ times($x, power($x, ${Expr(y-1)})) } + else '{ times($x, power($x, ${Value(y-1)})) } }), fixPoint = true ) @@ -38,8 +38,8 @@ private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { val x2 = rewriter.transform(x) '{ - println(${Expr(x.show)}) - println(${Expr(x2.show)}) + println(${Value(x.show)}) + println(${Value(x2.show)}) println() $x2 } diff --git a/tests/run-macros/flops-rewrite-3/Macro_1.scala b/tests/run-macros/flops-rewrite-3/Macro_1.scala index 406b0af22c82..63c29958a3ad 100644 --- a/tests/run-macros/flops-rewrite-3/Macro_1.scala +++ b/tests/run-macros/flops-rewrite-3/Macro_1.scala @@ -13,7 +13,7 @@ private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { case '{ plus($x, $y) } => (x.value, y.value) match { case (Some(0), _) => y - case (Some(a), Some(b)) => Expr(a + b) + case (Some(a), Some(b)) => Value(a + b) case (_, Some(_)) => '{ $y + $x } case _ => '{ $x + $y } } @@ -21,23 +21,23 @@ private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { (x.value, y.value) match { case (Some(0), _) => '{0} case (Some(1), _) => y - case (Some(a), Some(b)) => Expr(a * b) + case (Some(a), Some(b)) => Value(a * b) case (_, Some(_)) => '{ $y * $x } case _ => '{ $x * $y } } case '{ power(${Const(x)}, ${Const(y)}) } => - Expr(power(x, y)) + Value(power(x, y)) case '{ power($x, ${Const(y)}) } => if y == 0 then '{1} - else '{ times($x, power($x, ${Expr(y-1)})) } + else '{ times($x, power($x, ${Value(y-1)})) } } ) val x2 = rewriter.transform(x) '{ - println(${Expr(x.show)}) - println(${Expr(x2.show)}) + println(${Value(x.show)}) + println(${Value(x2.show)}) println() $x2 } diff --git a/tests/run-macros/flops-rewrite/Macro_1.scala b/tests/run-macros/flops-rewrite/Macro_1.scala index cfabc79acc1f..9da7feba94d8 100644 --- a/tests/run-macros/flops-rewrite/Macro_1.scala +++ b/tests/run-macros/flops-rewrite/Macro_1.scala @@ -16,8 +16,8 @@ private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { val x2 = rewriter.transform(x) '{ - println(${Expr(x.show)}) - println(${Expr(x2.show)}) + println(${Value(x.show)}) + println(${Value(x2.show)}) println() $x2 } diff --git a/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala b/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala index 2b7bf43fafa9..8a6d711827d2 100644 --- a/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala +++ b/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala @@ -8,21 +8,21 @@ object TypeToolbox { inline def =:=[A, B]: Boolean = ${tpEqImpl[A, B]} private def tpEqImpl[A: Type, B: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[A] =:= TypeRepr.of[B]) + Value(TypeRepr.of[A] =:= TypeRepr.of[B]) } /** is `tp1` a subtype of `tp2` */ inline def <:<[A, B]: Boolean = ${tpLEqImpl[A, B]} private def tpLEqImpl[A: Type, B: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[A] <:< TypeRepr.of[B]) + Value(TypeRepr.of[A] <:< TypeRepr.of[B]) } /** type associated with the tree */ inline def typeOf[T, Expected](a: T): Boolean = ${typeOfImpl[T, Expected]('a)} private def typeOfImpl[A: Type, E: Type](a: Expr[A])(using Quotes) : Expr[Boolean] = { import quotes.reflect._ - Expr(TypeRepr.of[A] =:= TypeRepr.of[E]) + Value(TypeRepr.of[A] =:= TypeRepr.of[E]) } /** does the type refer to a case class? */ @@ -30,7 +30,7 @@ object TypeToolbox { private def isCaseClassImpl[T: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ val sym = TypeTree.of[T].symbol - Expr(sym.isClassDef && sym.flags.is(Flags.Case)) + Value(sym.isClassDef && sym.flags.is(Flags.Case)) } /** val fields of a case class Type -- only the ones declared in primary constructor */ @@ -38,59 +38,59 @@ object TypeToolbox { private def caseFieldsImpl[T: Type](using Quotes) : Expr[List[String]] = { import quotes.reflect._ val fields = TypeTree.of[T].symbol.caseFields.map(_.name) - Expr(fields) + Value(fields) } inline def fieldIn[T](inline mem: String): String = ${fieldInImpl[T]('mem)} private def fieldInImpl[T: Type](mem: Expr[String])(using Quotes) : Expr[String] = { import quotes.reflect._ val field = TypeTree.of[T].symbol.field(mem.valueOrError) - Expr(if field.isNoSymbol then "" else field.name) + Value(if field.isNoSymbol then "" else field.name) } inline def fieldsIn[T]: Seq[String] = ${fieldsInImpl[T]} private def fieldsInImpl[T: Type](using Quotes) : Expr[Seq[String]] = { import quotes.reflect._ val fields = TypeTree.of[T].symbol.fields - Expr(fields.map(_.name).toList) + Value(fields.map(_.name).toList) } inline def methodIn[T](inline mem: String): Seq[String] = ${methodInImpl[T]('mem)} private def methodInImpl[T: Type](mem: Expr[String])(using Quotes) : Expr[Seq[String]] = { import quotes.reflect._ - Expr(TypeTree.of[T].symbol.declaredMethod(mem.valueOrError).map(_.name)) + Value(TypeTree.of[T].symbol.declaredMethod(mem.valueOrError).map(_.name)) } inline def methodsIn[T]: Seq[String] = ${methodsInImpl[T]} private def methodsInImpl[T: Type](using Quotes) : Expr[Seq[String]] = { import quotes.reflect._ - Expr(TypeTree.of[T].symbol.declaredMethods.map(_.name)) + Value(TypeTree.of[T].symbol.declaredMethods.map(_.name)) } inline def method[T](inline mem: String): Seq[String] = ${methodImpl[T]('mem)} private def methodImpl[T: Type](mem: Expr[String])(using Quotes) : Expr[Seq[String]] = { import quotes.reflect._ - Expr(TypeTree.of[T].symbol.memberMethod(mem.valueOrError).map(_.name)) + Value(TypeTree.of[T].symbol.memberMethod(mem.valueOrError).map(_.name)) } inline def methods[T]: Seq[String] = ${methodsImpl[T]} private def methodsImpl[T: Type](using Quotes) : Expr[Seq[String]] = { import quotes.reflect._ - Expr(TypeTree.of[T].symbol.memberMethods.map(_.name)) + Value(TypeTree.of[T].symbol.memberMethods.map(_.name)) } inline def typeTag[T](x: T): String = ${typeTagImpl[T]} private def typeTagImpl[T: Type](using Quotes) : Expr[String] = { import quotes.reflect._ val res = TypeRepr.of[T].show - Expr(res) + Value(res) } inline def companion[T1, T2]: Boolean = ${companionImpl[T1, T2]} private def companionImpl[T1: Type, T2: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ val res = TypeTree.of[T1].symbol.companionModule == TypeTree.of[T2].symbol - Expr(res) + Value(res) } inline def companionName[T1]: String = ${companionNameImpl[T1]} @@ -101,7 +101,7 @@ object TypeToolbox { if sym.isClassDef then sym.companionModule.companionClass else if sym.isValDef then sym.companionClass else Symbol.noSymbol - Expr(if companionClass.isNoSymbol then "" else companionClass.fullName) + Value(if companionClass.isNoSymbol then "" else companionClass.fullName) } } diff --git a/tests/run-macros/i10011/Macro_1.scala b/tests/run-macros/i10011/Macro_1.scala index 376a39ab1ae1..04011e5b1a65 100644 --- a/tests/run-macros/i10011/Macro_1.scala +++ b/tests/run-macros/i10011/Macro_1.scala @@ -6,4 +6,4 @@ inline def printPos[T](inline expr: T): (Int, Int) = private def printPos[T](expr: Expr[T])(using Quotes): Expr[(Int, Int)] = import quotes.reflect._ val pos = Term.of(expr).pos - Expr((pos.start, pos.end)) + Value((pos.start, pos.end)) diff --git a/tests/run-macros/i10464/Macro_1.scala b/tests/run-macros/i10464/Macro_1.scala index 063a3928e3c7..f9910ade0419 100644 --- a/tests/run-macros/i10464/Macro_1.scala +++ b/tests/run-macros/i10464/Macro_1.scala @@ -10,7 +10,7 @@ object MatchMac { case '{ ($f: Person).name } => "matched!" case _ => "not matched" } - '{ println(${Expr(res)}) } + '{ println(${Value(res)}) } } } diff --git a/tests/run-macros/i4734/Macro_1.scala b/tests/run-macros/i4734/Macro_1.scala index e9cca32ca0ce..28594c3a33af 100644 --- a/tests/run-macros/i4734/Macro_1.scala +++ b/tests/run-macros/i4734/Macro_1.scala @@ -10,17 +10,17 @@ object Macros { def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSize: Int)(using Quotes): Expr[Unit] = '{ val size = ($seq).length - assert(size % (${Expr(unrollSize)}) == 0) // for simplicity of the implementation + assert(size % (${Value(unrollSize)}) == 0) // for simplicity of the implementation var i = 0 while (i < size) { ${ for (j <- new UnrolledRange(0, unrollSize)) '{ - val index = i + ${Expr(j)} + val index = i + ${Value(j)} val element = ($seq)(index) ${ Expr.betaReduce('{$f(element)}) } // or `($f)(element)` if `f` should not be inlined } } - i += ${Expr(unrollSize)} + i += ${Value(unrollSize)} } } diff --git a/tests/run-macros/i4735/Macro_1.scala b/tests/run-macros/i4735/Macro_1.scala index 482652a37192..e84ec1f4af41 100644 --- a/tests/run-macros/i4735/Macro_1.scala +++ b/tests/run-macros/i4735/Macro_1.scala @@ -15,7 +15,7 @@ object Macro { println(" start loop") ${ for (j <- new UnrolledRange(0, unrollSize.valueOrError)) '{ - val element = ($seq)(i + ${Expr(j)}) + val element = ($seq)(i + ${Value(j)}) ${Expr.betaReduce('{$f(element)})} // or `($f)(element)` if `f` should not be inlined } } diff --git a/tests/run-macros/i5119/Macro_1.scala b/tests/run-macros/i5119/Macro_1.scala index edae1bd90c76..8cb316874424 100644 --- a/tests/run-macros/i5119/Macro_1.scala +++ b/tests/run-macros/i5119/Macro_1.scala @@ -7,6 +7,6 @@ object Macro { implicit inline def XmlQuote(inline sc: StringContext): StringContextOps = new StringContextOps(sc) def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import quotes.reflect._ - Expr(Term.of(sc).underlyingArgument.showExtractors + "\n" + Term.of(args).underlyingArgument.showExtractors) + Value(Term.of(sc).underlyingArgument.showExtractors + "\n" + Term.of(args).underlyingArgument.showExtractors) } } diff --git a/tests/run-macros/i5119b/Macro_1.scala b/tests/run-macros/i5119b/Macro_1.scala index cccb1dc819b4..07c1b3be2c4d 100644 --- a/tests/run-macros/i5119b/Macro_1.scala +++ b/tests/run-macros/i5119b/Macro_1.scala @@ -7,6 +7,6 @@ object Macro { def impl(arg1: Expr[Any], arg2: Expr[Any])(using Quotes) : Expr[String] = import quotes.reflect._ - Expr(Term.of(arg1).underlyingArgument.showExtractors + "\n" + Term.of(arg2).underlyingArgument.showExtractors) + Value(Term.of(arg1).underlyingArgument.showExtractors + "\n" + Term.of(arg2).underlyingArgument.showExtractors) } diff --git a/tests/run-macros/i5188a/Macro_1.scala b/tests/run-macros/i5188a/Macro_1.scala index 58a51d476312..94fa9ef632be 100644 --- a/tests/run-macros/i5188a/Macro_1.scala +++ b/tests/run-macros/i5188a/Macro_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Lib { inline def sum(inline args: Int*): Int = ${ impl('args) } - def impl(args: Expr[Seq[Int]]) (using Quotes): Expr[Int] = Expr(args.valueOrError.sum) + def impl(args: Expr[Seq[Int]]) (using Quotes): Expr[Int] = Value(args.valueOrError.sum) } diff --git a/tests/run-macros/i5629/Macro_1.scala b/tests/run-macros/i5629/Macro_1.scala index 159df2b24838..b19b4db51ec5 100644 --- a/tests/run-macros/i5629/Macro_1.scala +++ b/tests/run-macros/i5629/Macro_1.scala @@ -14,6 +14,6 @@ object Macros { def thisLineNumberImpl(using Quotes) : Expr[Int] = { import quotes.reflect._ - Expr(Position.ofMacroExpansion.startLine) + Value(Position.ofMacroExpansion.startLine) } } diff --git a/tests/run-macros/i6201/macro_1.scala b/tests/run-macros/i6201/macro_1.scala index 9dd1bc6a9fe9..fd52f77aad44 100644 --- a/tests/run-macros/i6201/macro_1.scala +++ b/tests/run-macros/i6201/macro_1.scala @@ -4,10 +4,10 @@ extension (inline x: String) inline def strip: String = ${ stripImpl('x) } def stripImpl(x: Expr[String])(using Quotes) : Expr[String] = - Expr(x.valueOrError.stripMargin) + Value(x.valueOrError.stripMargin) inline def isHello(inline x: String): Boolean = ${ isHelloImpl('x) } def isHelloImpl(x: Expr[String])(using Quotes) : Expr[Boolean] = - if (x.valueOrError == "hello") Expr(true) else Expr(false) + if (x.valueOrError == "hello") Value(true) else Value(false) diff --git a/tests/run-macros/i6270/Macro_1.scala b/tests/run-macros/i6270/Macro_1.scala index 9140a5e8e22d..07bd774ca7c4 100644 --- a/tests/run-macros/i6270/Macro_1.scala +++ b/tests/run-macros/i6270/Macro_1.scala @@ -6,7 +6,7 @@ object api { private def reflImpl(x: Expr[String])(using Quotes) : Expr[String] = { import quotes.reflect._ - Expr(x.show) + Value(x.show) } extension (x: => String) inline def reflectColor : String = @@ -14,6 +14,6 @@ object api { private def reflImplColor(x: Expr[String])(using Quotes) : Expr[String] = { import quotes.reflect._ - Expr(x.showAnsiColored) + Value(x.showAnsiColored) } } diff --git a/tests/run-macros/i6518/Macro_1.scala b/tests/run-macros/i6518/Macro_1.scala index 0185b311d332..151d2d9c2bd6 100644 --- a/tests/run-macros/i6518/Macro_1.scala +++ b/tests/run-macros/i6518/Macro_1.scala @@ -10,7 +10,7 @@ object Macros { classSym.declaredMethod("apply") classSym.declaredMethods classSym.memberMethod("apply") - Expr(classSym.memberMethods.map(_.name).sorted.mkString("\n")) + Value(classSym.memberMethods.map(_.name).sorted.mkString("\n")) } } diff --git a/tests/run-macros/i6765-b/Macro_1.scala b/tests/run-macros/i6765-b/Macro_1.scala index 1beb85e13495..4abd4543899b 100644 --- a/tests/run-macros/i6765-b/Macro_1.scala +++ b/tests/run-macros/i6765-b/Macro_1.scala @@ -4,5 +4,5 @@ inline def foo = ${fooImpl} def fooImpl(using Quotes) = { val res = Expr.ofList(List('{"One"})) - Expr(res.show) + Value(res.show) } diff --git a/tests/run-macros/i6765-c/Macro_1.scala b/tests/run-macros/i6765-c/Macro_1.scala index d8f3d3baf7bb..f9b04500972b 100644 --- a/tests/run-macros/i6765-c/Macro_1.scala +++ b/tests/run-macros/i6765-c/Macro_1.scala @@ -3,6 +3,6 @@ import scala.quoted._ inline def foo(inline n: Int) = ${fooImpl('n)} def fooImpl(n: Expr[Int])(using Quotes) = { - val res = Expr.ofList(List.tabulate(n.valueOrError)(i => Expr("#" + i))) - '{ ${Expr(res.show)} + "\n" + $res.toString + "\n" } + val res = Expr.ofList(List.tabulate(n.valueOrError)(i => Value("#" + i))) + '{ ${Value(res.show)} + "\n" + $res.toString + "\n" } } diff --git a/tests/run-macros/i6765/Macro_1.scala b/tests/run-macros/i6765/Macro_1.scala index 15a8a1714772..1ecc40db68d4 100644 --- a/tests/run-macros/i6765/Macro_1.scala +++ b/tests/run-macros/i6765/Macro_1.scala @@ -5,5 +5,5 @@ inline def foo = ${fooImpl} def fooImpl(using Quotes) = { import quotes.reflect._ val res = Expr.ofList(List('{"One"})) - Expr(res.show) + Value(res.show) } diff --git a/tests/run-macros/i6772/Macro_1.scala b/tests/run-macros/i6772/Macro_1.scala index e1bb395dbd77..b4a872333f8d 100644 --- a/tests/run-macros/i6772/Macro_1.scala +++ b/tests/run-macros/i6772/Macro_1.scala @@ -5,7 +5,7 @@ object Macros { inline def m() : Any = ${ mImpl() } def mImpl()(using Quotes): Expr[Any] = - List(Expr(1), Expr(2), Expr(3)).toExprOfList + List(Value(1), Value(2), Value(3)).toExprOfList extension [T](list: List[Expr[T]]) def toExprOfList(using Type[T], Quotes): Expr[List[T]] = '{ val buff = List.newBuilder[T] diff --git a/tests/run-macros/i6803/Macro_1.scala b/tests/run-macros/i6803/Macro_1.scala index 795dd2fc4538..a4e78e15f3c8 100644 --- a/tests/run-macros/i6803/Macro_1.scala +++ b/tests/run-macros/i6803/Macro_1.scala @@ -10,7 +10,7 @@ object AsObject { inline given LineNo = ${impl} private def impl(using Quotes): Expr[LineNo] = { import quotes.reflect._ - '{unsafe(${Expr(Position.ofMacroExpansion.startLine)})} + '{unsafe(${Value(Position.ofMacroExpansion.startLine)})} } } } @@ -22,7 +22,7 @@ package AsPackage { inline given LineNo = ${impl} private def impl(using Quotes): Expr[LineNo] = { import quotes.reflect._ - '{unsafe(${Expr(Position.ofMacroExpansion.startLine)})} + '{unsafe(${Value(Position.ofMacroExpansion.startLine)})} } } } diff --git a/tests/run-macros/i6988/FirstArg_1.scala b/tests/run-macros/i6988/FirstArg_1.scala index 56a286dcbf82..c37606bcf20d 100644 --- a/tests/run-macros/i6988/FirstArg_1.scala +++ b/tests/run-macros/i6988/FirstArg_1.scala @@ -27,6 +27,6 @@ object Macros { val paramss = enclosingParamList(Symbol.spliceOwner) val firstArg = paramss.flatten.head val ref = Select.unique(This(enclosingClass()), firstArg.name) - '{ FirstArg(${ref.asExpr}, ${Expr(firstArg.name)}) } + '{ FirstArg(${ref.asExpr}, ${Value(firstArg.name)}) } } } diff --git a/tests/run-macros/i7025/Macros_1.scala b/tests/run-macros/i7025/Macros_1.scala index 456902b1a617..31241131a88e 100644 --- a/tests/run-macros/i7025/Macros_1.scala +++ b/tests/run-macros/i7025/Macros_1.scala @@ -13,7 +13,7 @@ object Macros { val x = nearestEnclosingDef(Symbol.spliceOwner) if x.isDefDef then val code = x.signature.toString - '{ println(${Expr(code)}) } + '{ println(${Value(code)}) } else '{()} } diff --git a/tests/run-macros/i7519c/Macro_1.scala b/tests/run-macros/i7519c/Macro_1.scala index da7f7a2288f6..37cbc6dd6b73 100644 --- a/tests/run-macros/i7519c/Macro_1.scala +++ b/tests/run-macros/i7519c/Macro_1.scala @@ -9,5 +9,5 @@ inline def quote[T]: String = ${ quoteImpl[T] } def quoteImpl[T: Type](using Quotes): Expr[String] = { val value: Expr[Int] = '{ 42 } - Expr(('{ new Quoted[T @Annot($value)] }).show) + Value(('{ new Quoted[T @Annot($value)] }).show) } diff --git a/tests/run-macros/i7898/Macro_1.scala b/tests/run-macros/i7898/Macro_1.scala index 6b1a0e59d8ff..d1cc3f5e0ecd 100644 --- a/tests/run-macros/i7898/Macro_1.scala +++ b/tests/run-macros/i7898/Macro_1.scala @@ -7,7 +7,7 @@ object Main { val bodyTerm = Term.of(underlyingArgument(body)) val showed = bodyTerm.show '{ - println(${Expr(showed)}) + println(${Value(showed)}) ${bodyTerm.asExpr} } } diff --git a/tests/run-macros/i7964/Macro_1.scala b/tests/run-macros/i7964/Macro_1.scala index c2054c4372b6..6897576f98e6 100644 --- a/tests/run-macros/i7964/Macro_1.scala +++ b/tests/run-macros/i7964/Macro_1.scala @@ -12,7 +12,7 @@ private def fooExpr(numExpr: Expr[Num]) (using Quotes): Expr[Int] = case '{ Num.One } => Num.One case '{ Num.Two } => Num.Two } - Expr(toInt(num)) + Value(toInt(num)) private def toInt(num: Num): Int = num match { case Num.One => 1 diff --git a/tests/run-macros/i7987/Macros_1.scala b/tests/run-macros/i7987/Macros_1.scala index ecb136b23d49..1dbc4d0e950b 100644 --- a/tests/run-macros/i7987/Macros_1.scala +++ b/tests/run-macros/i7987/Macros_1.scala @@ -7,6 +7,6 @@ object Macros { def macroImpl[T]()(using Quotes): Expr[String] = { Expr.summon[Mirror.Of[Some[Int]]] match - case Some('{ $_ : t }) => Expr(Type.show[t]) + case Some('{ $_ : t }) => Value(Type.show[t]) } } diff --git a/tests/run-macros/i8007/Macro_1.scala b/tests/run-macros/i8007/Macro_1.scala index 56f72417ed86..2143373e0eaa 100644 --- a/tests/run-macros/i8007/Macro_1.scala +++ b/tests/run-macros/i8007/Macro_1.scala @@ -23,7 +23,7 @@ object Macro1 { Expr.summon(using mirrorTpe).get match { case '{ $m: Mirror.ProductOf[T]{ type MirroredElemLabels = elems } } => { - Expr(mirrorFields[elems]) + Value(mirrorFields[elems]) } } } diff --git a/tests/run-macros/i8007/Macro_2.scala b/tests/run-macros/i8007/Macro_2.scala index 506d09a13888..9fe1d167a16a 100644 --- a/tests/run-macros/i8007/Macro_2.scala +++ b/tests/run-macros/i8007/Macro_2.scala @@ -29,7 +29,7 @@ object Macro2 { } val body: Expr[T] => Expr[String] = elem => - fields.reverse.foldLeft(Expr("")){ (acc, field) => + fields.reverse.foldLeft(Value("")){ (acc, field) => val res = Select.unique(Term.of(elem), field).asExpr '{ $res.toString + " " + $acc } } diff --git a/tests/run-macros/i8007/Macro_3.scala b/tests/run-macros/i8007/Macro_3.scala index 6848627da138..f56ee0d7eb9d 100644 --- a/tests/run-macros/i8007/Macro_3.scala +++ b/tests/run-macros/i8007/Macro_3.scala @@ -41,10 +41,10 @@ object Eq { case '{ $m: Mirror.ProductOf[T] { type MirroredElemTypes = elementTypes }} => val elemInstances = summonAll[elementTypes] val eqProductBody: (Expr[T], Expr[T]) => Expr[Boolean] = (x, y) => { - elemInstances.zipWithIndex.foldLeft(Expr(true: Boolean)) { + elemInstances.zipWithIndex.foldLeft(Value(true: Boolean)) { case (acc, (elem, index)) => - val e1 = '{$x.asInstanceOf[Product].productElement(${Expr(index)})} - val e2 = '{$y.asInstanceOf[Product].productElement(${Expr(index)})} + val e1 = '{$x.asInstanceOf[Product].productElement(${Value(index)})} + val e2 = '{$y.asInstanceOf[Product].productElement(${Value(index)})} '{ $acc && $elem.asInstanceOf[Eq[Any]].eqv($e1, $e2) } } diff --git a/tests/run-macros/i8514/Macro_1.scala b/tests/run-macros/i8514/Macro_1.scala index b70c107026f3..b9158ac14be5 100644 --- a/tests/run-macros/i8514/Macro_1.scala +++ b/tests/run-macros/i8514/Macro_1.scala @@ -10,9 +10,9 @@ def testExpr(using Quotes): Expr[Unit] = { import quotes.reflect._ '{ - println(${Expr(TypeRepr.of[Object].baseClasses.toString)}) - println(${Expr(TypeRepr.of[A].baseClasses.toString)}) - println(${Expr(TypeRepr.of[B].baseClasses.toString)}) - println(${Expr(TypeRepr.of[C].baseClasses.toString)}) + println(${Value(TypeRepr.of[Object].baseClasses.toString)}) + println(${Value(TypeRepr.of[A].baseClasses.toString)}) + println(${Value(TypeRepr.of[B].baseClasses.toString)}) + println(${Value(TypeRepr.of[C].baseClasses.toString)}) } } diff --git a/tests/run-macros/i8514b/Macro_1.scala b/tests/run-macros/i8514b/Macro_1.scala index ffa2a67f3ec9..c349ebb42d76 100644 --- a/tests/run-macros/i8514b/Macro_1.scala +++ b/tests/run-macros/i8514b/Macro_1.scala @@ -13,6 +13,6 @@ def testExpr(using Quotes): Expr[Unit] = { val baseTypes = t.baseClasses.map(b => t.baseType(b)) '{ - println(${Expr(baseTypes.map(_.show).mkString("\n"))}) + println(${Value(baseTypes.map(_.show).mkString("\n"))}) } } diff --git a/tests/run-macros/i8520/Macro_1.scala b/tests/run-macros/i8520/Macro_1.scala index 67bf962e69f9..e72f423e64c3 100644 --- a/tests/run-macros/i8520/Macro_1.scala +++ b/tests/run-macros/i8520/Macro_1.scala @@ -9,5 +9,5 @@ def testExpr[T[_]: Type](using Quotes): Expr[Unit] = { else if f.is(Flags.Contravariant) then "-" else " " val t = TypeRepr.of[T].typeSymbol.memberTypes.map(x => (x.name, variance(x.flags))) - '{ println(${Expr(t.toString)}) } + '{ println(${Value(t.toString)}) } } diff --git a/tests/run-macros/i8671/Macro_1.scala b/tests/run-macros/i8671/Macro_1.scala index 21adda3e15e8..134333c85393 100644 --- a/tests/run-macros/i8671/Macro_1.scala +++ b/tests/run-macros/i8671/Macro_1.scala @@ -17,7 +17,7 @@ object FileName { case Some(s) => fileNameFromString(s) match { case Right(fn) => - '{FileName.unsafe(${Expr(fn.name)})} // Or `Expr(fn)` if there is a `ToExpr[FileName]` + '{FileName.unsafe(${Value(fn.name)})} // Or `Value(fn)` if there is a `ToExpr[FileName]` case Left(_) => report.throwError(s"$s is not a valid file name! It must not contain a /", fileName) } diff --git a/tests/run-macros/i8745/Macro_1.scala b/tests/run-macros/i8745/Macro_1.scala index 23a44412789b..0a8d0dfb8d44 100644 --- a/tests/run-macros/i8745/Macro_1.scala +++ b/tests/run-macros/i8745/Macro_1.scala @@ -10,7 +10,7 @@ object Macro { def macImpl(tree: Expr[String])(using Quotes): Expr[String] = { tree match { case vv @ '{ ($s: Trait).fun($arg) } => arg - case _ => Expr("not matched") + case _ => Value("not matched") } } } diff --git a/tests/run-macros/i8746/Macro_1.scala b/tests/run-macros/i8746/Macro_1.scala index e8f8143b1f23..10ade41a80d2 100644 --- a/tests/run-macros/i8746/Macro_1.scala +++ b/tests/run-macros/i8746/Macro_1.scala @@ -4,7 +4,7 @@ object Macro { inline def mac(): String = ${ macImpl() } def macImpl()(using Quotes): Expr[String] = '{(x: String) => "anything"} match - case '{ (in: String) => ($out: tpe2) } => Expr(out.toString) + case '{ (in: String) => ($out: tpe2) } => Value(out.toString) case _ => ??? } diff --git a/tests/run-macros/i8746b/Macro_1.scala b/tests/run-macros/i8746b/Macro_1.scala index 8110716fa795..37e117b5c5ed 100644 --- a/tests/run-macros/i8746b/Macro_1.scala +++ b/tests/run-macros/i8746b/Macro_1.scala @@ -5,8 +5,8 @@ object Macro { inline def mac(inline tree: Any): String = ${ macImpl('tree) } def macImpl(tree: Expr[Any])(using Quotes): Expr[String] = { tree match { - case '{ (in: tpe1) => ($out: tpe2) } => Expr(out.toString) - case _ => Expr("not matched") + case '{ (in: tpe1) => ($out: tpe2) } => Value(out.toString) + case _ => Value("not matched") } } } diff --git a/tests/run-macros/i9206/Macros_1.scala b/tests/run-macros/i9206/Macros_1.scala index 83692c4960b8..cf2f8ba62211 100644 --- a/tests/run-macros/i9206/Macros_1.scala +++ b/tests/run-macros/i9206/Macros_1.scala @@ -7,6 +7,6 @@ object Inspect { def inspectTpe[T <: AnyKind: Type](using Quotes): Expr[String] = { import quotes.reflect.TypeRepr val tree = TypeRepr.of[T].typeSymbol.tree - Expr(tree.show) + Value(tree.show) } } diff --git a/tests/run-macros/i9570/Macro_1.scala b/tests/run-macros/i9570/Macro_1.scala index c8a9aa196713..3d8a26e0283f 100644 --- a/tests/run-macros/i9570/Macro_1.scala +++ b/tests/run-macros/i9570/Macro_1.scala @@ -13,7 +13,7 @@ object Macros { case '{HCons($_,$t)} => //case '{HCons($a,$t)} => sizeImpl(t,n+1) - case '{HNil} => Expr(n) + case '{HNil} => Value(n) } } diff --git a/tests/run-macros/inferred-repeated-result/test_1.scala b/tests/run-macros/inferred-repeated-result/test_1.scala index d27d2f9360d0..27e561ad5d7f 100644 --- a/tests/run-macros/inferred-repeated-result/test_1.scala +++ b/tests/run-macros/inferred-repeated-result/test_1.scala @@ -16,6 +16,6 @@ object Macros { s"$name : $returnType" }.sorted - methods.foldLeft('{}) { (res, m) => '{ $res; println(${Expr(m)}) } } + methods.foldLeft('{}) { (res, m) => '{ $res; println(${Value(m)}) } } } } diff --git a/tests/run-macros/inline-case-objects/Macro_1.scala b/tests/run-macros/inline-case-objects/Macro_1.scala index 3839dfdd870a..91e3aa86e479 100644 --- a/tests/run-macros/inline-case-objects/Macro_1.scala +++ b/tests/run-macros/inline-case-objects/Macro_1.scala @@ -11,7 +11,7 @@ object Macros { case '{ foo.Bar } => foo.Bar case '{ foo.Bar.Baz } => foo.Bar.Baz } - Expr(obj.getClass.getCanonicalName) + Value(obj.getClass.getCanonicalName) } case object Bar { diff --git a/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala b/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala index d88b2e53f2c7..fa7bb23def22 100644 --- a/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala +++ b/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala @@ -32,11 +32,11 @@ trait E[T] { } case class I(n: Int) extends E[Int] { - def lift (using Quotes): Expr[Int] = Expr(n) + def lift (using Quotes): Expr[Int] = Value(n) } case class D(n: Double) extends E[Double] { - def lift (using Quotes): Expr[Double] = Expr(n) + def lift (using Quotes): Expr[Double] = Value(n) } case class Plus[T](x: E[T], y: E[T])(implicit op: Plus2[T]) extends E[T] { diff --git a/tests/run-macros/inline-option/Macro_1.scala b/tests/run-macros/inline-option/Macro_1.scala index 4656859286ac..f6878ddb62d4 100644 --- a/tests/run-macros/inline-option/Macro_1.scala +++ b/tests/run-macros/inline-option/Macro_1.scala @@ -4,10 +4,10 @@ import scala.quoted._ object Macros { def impl(opt: Expr[Option[Int]]) (using Quotes): Expr[Int] = opt.valueOrError match { - case Some(i) => Expr(i) + case Some(i) => Value(i) case None => '{-1} } - def impl2(opt: Expr[Option[Option[Int]]]) (using Quotes): Expr[Int] = impl(Expr(opt.valueOrError.flatten)) + def impl2(opt: Expr[Option[Option[Int]]]) (using Quotes): Expr[Int] = impl(Value(opt.valueOrError.flatten)) } diff --git a/tests/run-macros/inline-tuples-1/Macro_1.scala b/tests/run-macros/inline-tuples-1/Macro_1.scala index 76ba8fcb0dc0..1e7045d18ad9 100644 --- a/tests/run-macros/inline-tuples-1/Macro_1.scala +++ b/tests/run-macros/inline-tuples-1/Macro_1.scala @@ -2,26 +2,26 @@ import scala.quoted._ object Macros { - def tup1(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup2(tup: Expr[Tuple2[Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup1(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup2(tup: Expr[Tuple2[Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError.productIterator.map(_.asInstanceOf[Int]).sum) } diff --git a/tests/run-macros/inline-tuples-2/Macro_1.scala b/tests/run-macros/inline-tuples-2/Macro_1.scala index 6cbd8d929df4..762255c13957 100644 --- a/tests/run-macros/inline-tuples-2/Macro_1.scala +++ b/tests/run-macros/inline-tuples-2/Macro_1.scala @@ -3,8 +3,8 @@ import scala.quoted._ object Macros { - def impl(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Expr(tup.valueOrError._1) + def impl(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Value(tup.valueOrError._1) - def impl2(tup: Expr[Tuple1[Tuple1[Int]]]) (using Quotes): Expr[Int] = impl(Expr(tup.valueOrError._1)) + def impl2(tup: Expr[Tuple1[Tuple1[Int]]]) (using Quotes): Expr[Int] = impl(Value(tup.valueOrError._1)) } diff --git a/tests/run-macros/inline-varargs-1/Macro_1.scala b/tests/run-macros/inline-varargs-1/Macro_1.scala index 3dcd8b211931..66595a6fddba 100644 --- a/tests/run-macros/inline-varargs-1/Macro_1.scala +++ b/tests/run-macros/inline-varargs-1/Macro_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macros { - def sum(nums: Expr[Int]*) (using Quotes): Expr[Int] = Expr(nums.map(_.valueOrError).sum) + def sum(nums: Expr[Int]*) (using Quotes): Expr[Int] = Value(nums.map(_.valueOrError).sum) } diff --git a/tests/run-macros/paramSymss/Macro_1.scala b/tests/run-macros/paramSymss/Macro_1.scala index 4b482724ffd3..7156f7226c18 100644 --- a/tests/run-macros/paramSymss/Macro_1.scala +++ b/tests/run-macros/paramSymss/Macro_1.scala @@ -7,7 +7,7 @@ def showParamSymsExpr(using Quotes)(x: Expr[Any]): Expr[String] = import quotes.reflect._ val '{ $y: Any } = x // Drop Inlined not to access the symbol val sym = Term.of(y).symbol - Expr( + Value( s"""sym: ${sym.show} |paramSymss: ${sym.paramSymss.map(_.map(_.show))} |""".stripMargin) diff --git a/tests/run-macros/power-macro/Macro_1.scala b/tests/run-macros/power-macro/Macro_1.scala index 98b288fe6838..fe987e87e529 100644 --- a/tests/run-macros/power-macro/Macro_1.scala +++ b/tests/run-macros/power-macro/Macro_1.scala @@ -7,7 +7,7 @@ private def powerCode1(using Quotes)(x: Expr[Double], n: Expr[Int]): Expr[Double powerCode(x, n.valueOrError) private def powerCode(using Quotes)(x: Expr[Double], n: Int): Expr[Double] = - if (n == 0) Expr(1.0) + if (n == 0) Value(1.0) else if (n == 1) x else if (n % 2 == 0) '{ val y = $x * $x; ${ powerCode('y, n / 2) } } else '{ $x * ${ powerCode(x, n - 1) } } diff --git a/tests/run-macros/quote-force/quoted_1.scala b/tests/run-macros/quote-force/quoted_1.scala index 4c3f0844dbbb..5d48c13018fa 100644 --- a/tests/run-macros/quote-force/quoted_1.scala +++ b/tests/run-macros/quote-force/quoted_1.scala @@ -7,7 +7,7 @@ object Location { implicit inline def location: Location = ${impl} def impl(using Quotes): Expr[Location] = { - val list = Expr(List("a", "b", "c", "d", "e", "f")) + val list = Value(List("a", "b", "c", "d", "e", "f")) '{new Location(${list})} } diff --git a/tests/run-macros/quote-impure-by-name/quoted_1.scala b/tests/run-macros/quote-impure-by-name/quoted_1.scala index df3252efc958..d9cbec6cce10 100644 --- a/tests/run-macros/quote-impure-by-name/quoted_1.scala +++ b/tests/run-macros/quote-impure-by-name/quoted_1.scala @@ -12,6 +12,6 @@ object Index { def succImpl[K: Type, H: Type, T: Type](prev: Expr[Index[K, T]])(using Quotes): Expr[Index[K, (H, T)]] = { val value = s"1 + {${prev.show}}" - '{new Index(${Expr(value)})} + '{new Index(${Value(value)})} } } diff --git a/tests/run-macros/quote-inline-function/quoted_1.scala b/tests/run-macros/quote-inline-function/quoted_1.scala index 45317b7ded9f..42e3178932af 100644 --- a/tests/run-macros/quote-inline-function/quoted_1.scala +++ b/tests/run-macros/quote-inline-function/quoted_1.scala @@ -21,6 +21,6 @@ object Macros { i < j } do () } - Expr(res.show) + Value(res.show) } } diff --git a/tests/run-macros/quote-matcher-runtime.check b/tests/run-macros/quote-matcher-runtime.check index 9d184cb7cacd..f80a803e0130 100644 --- a/tests/run-macros/quote-matcher-runtime.check +++ b/tests/run-macros/quote-matcher-runtime.check @@ -20,35 +20,35 @@ Result: Some(List()) Scrutinee: 3 Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(3))) +Result: Some(List(Value(3))) Scrutinee: x Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(x))) +Result: Some(List(Value(x))) Scrutinee: 5 Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Any] -Result: Some(List(Expr(5))) +Result: Some(List(Value(5))) Scrutinee: 6.+(x) Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(6.+(x)))) +Result: Some(List(Value(6.+(x)))) Scrutinee: 6.+(x) Pattern: 6.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) -Result: Some(List(Expr(x))) +Result: Some(List(Value(x))) Scrutinee: 6.+(x) Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int].+(x) -Result: Some(List(Expr(6))) +Result: Some(List(Value(6))) Scrutinee: 6.+(x) Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int].+(scala.quoted.runtime.Patterns.patternHole[scala.Int]) -Result: Some(List(Expr(6), Expr(x))) +Result: Some(List(Value(6), Value(x))) Scrutinee: 6.+(x).+(y) Pattern: 6.+(scala.quoted.runtime.Patterns.patternHole[scala.Int]).+(y) -Result: Some(List(Expr(x))) +Result: Some(List(Value(x))) Scrutinee: 4 Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Predef.String] @@ -84,23 +84,23 @@ Result: None Scrutinee: f(4) Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(f(4)))) +Result: Some(List(Value(f(4)))) Scrutinee: f(5) Pattern: f(scala.quoted.runtime.Patterns.patternHole[scala.Int]) -Result: Some(List(Expr(5))) +Result: Some(List(Value(5))) Scrutinee: g[scala.Int] Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(g[scala.Int]))) +Result: Some(List(Value(g[scala.Int]))) Scrutinee: h[scala.Int](7) Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(h[scala.Int](7)))) +Result: Some(List(Value(h[scala.Int](7)))) Scrutinee: h[scala.Int](8) Pattern: h[scala.Int](scala.quoted.runtime.Patterns.patternHole[scala.Int]) -Result: Some(List(Expr(8))) +Result: Some(List(Value(8))) Scrutinee: Test.this Pattern: Test.this @@ -108,7 +108,7 @@ Result: Some(List()) Scrutinee: Test.this Pattern: scala.quoted.runtime.Patterns.patternHole[this.type] -Result: Some(List(Expr(Test.this))) +Result: Some(List(Value(Test.this))) Scrutinee: new Foo(1) Pattern: new Foo(1) @@ -116,11 +116,11 @@ Result: Some(List()) Scrutinee: new Foo(1) Pattern: scala.quoted.runtime.Patterns.patternHole[Foo] -Result: Some(List(Expr(new Foo(1)))) +Result: Some(List(Value(new Foo(1)))) Scrutinee: new Foo(1) Pattern: new Foo(scala.quoted.runtime.Patterns.patternHole[scala.Int]) -Result: Some(List(Expr(1))) +Result: Some(List(Value(1))) Scrutinee: if (b) x else y Pattern: if (b) x else y @@ -128,11 +128,11 @@ Result: Some(List()) Scrutinee: if (b) x else y Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(if (b) x else y))) +Result: Some(List(Value(if (b) x else y))) Scrutinee: if (b) x else y Pattern: if (scala.quoted.runtime.Patterns.patternHole[scala.Boolean]) scala.quoted.runtime.Patterns.patternHole[scala.Int] else scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(b), Expr(x), Expr(y))) +Result: Some(List(Value(b), Value(x), Value(y))) Scrutinee: while (b) { x @@ -149,7 +149,7 @@ Scrutinee: while (b) { () } Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Unit] -Result: Some(List(Expr(while (b) { +Result: Some(List(Value(while (b) { x () }))) @@ -162,7 +162,7 @@ Pattern: while (scala.quoted.runtime.Patterns.patternHole[scala.Boolean]) { scala.quoted.runtime.Patterns.patternHole[scala.Int] () } -Result: Some(List(Expr(b), Expr(x))) +Result: Some(List(Value(b), Value(x))) Scrutinee: z = 4 Pattern: z = 4 @@ -170,11 +170,11 @@ Result: Some(List()) Scrutinee: z = 4 Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Unit] -Result: Some(List(Expr(z = 4))) +Result: Some(List(Value(z = 4))) Scrutinee: z = 4 Pattern: z = scala.quoted.runtime.Patterns.patternHole[scala.Int] -Result: Some(List(Expr(4))) +Result: Some(List(Value(4))) Scrutinee: 1 Pattern: 1 @@ -190,7 +190,7 @@ Result: Some(List()) Scrutinee: fs() Pattern: fs(scala.quoted.runtime.Patterns.patternHole[scala.Seq[scala.Int]]: _*) -Result: Some(List(Expr())) +Result: Some(List(Value())) Scrutinee: fs(1, 2, 3) Pattern: fs(1, 2, 3) @@ -198,11 +198,11 @@ Result: Some(List()) Scrutinee: fs(1, 2, 3) Pattern: fs(scala.quoted.runtime.Patterns.patternHole[scala.Int], scala.quoted.runtime.Patterns.patternHole[scala.Int], 3) -Result: Some(List(Expr(1), Expr(2))) +Result: Some(List(Value(1), Value(2))) Scrutinee: fs(1, 2, 3) Pattern: fs(scala.quoted.runtime.Patterns.patternHole[scala.Seq[scala.Int]]: _*) -Result: Some(List(Expr(1, 2, 3))) +Result: Some(List(Value(1, 2, 3))) Scrutinee: f2(1, 2) Pattern: f2(1, 2) @@ -214,7 +214,7 @@ Result: Some(List()) Scrutinee: f2(a = 1, b = 2) Pattern: f2(a = scala.quoted.runtime.Patterns.patternHole[scala.Int], b = scala.quoted.runtime.Patterns.patternHole[scala.Int]) -Result: Some(List(Expr(1), Expr(2))) +Result: Some(List(Value(1), Value(2))) Scrutinee: super.toString() Pattern: super.toString() @@ -222,23 +222,23 @@ Result: Some(List()) Scrutinee: (() => "abc") Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function0[scala.Predef.String]] -Result: Some(List(Expr((() => "abc")))) +Result: Some(List(Value((() => "abc")))) Scrutinee: (() => "abc").apply() Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function0[scala.Predef.String]].apply() -Result: Some(List(Expr((() => "abc")))) +Result: Some(List(Value((() => "abc")))) Scrutinee: ((x: scala.Int) => "abc") Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, scala.Predef.String]] -Result: Some(List(Expr(((x: scala.Int) => "abc")))) +Result: Some(List(Value(((x: scala.Int) => "abc")))) Scrutinee: ((x: scala.Int) => "abc").apply(4) Pattern: scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, scala.Predef.String]].apply(4) -Result: Some(List(Expr(((x: scala.Int) => "abc")))) +Result: Some(List(Value(((x: scala.Int) => "abc")))) Scrutinee: ((x: scala.Int) => "abc") Pattern: ((x: scala.Int) => scala.quoted.runtime.Patterns.patternHole[scala.Predef.String]) -Result: Some(List(Expr("abc"))) +Result: Some(List(Value("abc"))) Scrutinee: scala.StringContext.apply("abc", "xyz") Pattern: scala.StringContext.apply("abc", "xyz") @@ -246,11 +246,11 @@ Result: Some(List()) Scrutinee: scala.StringContext.apply("abc", "xyz") Pattern: scala.StringContext.apply(scala.quoted.runtime.Patterns.patternHole[java.lang.String], scala.quoted.runtime.Patterns.patternHole[java.lang.String]) -Result: Some(List(Expr("abc"), Expr("xyz"))) +Result: Some(List(Value("abc"), Value("xyz"))) Scrutinee: scala.StringContext.apply("abc", "xyz") Pattern: scala.StringContext.apply(scala.quoted.runtime.Patterns.patternHole[scala.Seq[scala.Predef.String]]: _*) -Result: Some(List(Expr("abc", "xyz"))) +Result: Some(List(Value("abc", "xyz"))) Scrutinee: { val a: scala.Int = 45 @@ -270,7 +270,7 @@ Pattern: { val a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } -Result: Some(List(Expr(45))) +Result: Some(List(Value(45))) Scrutinee: { val a: scala.Int = 45 @@ -502,7 +502,7 @@ Pattern: { def a: scala.Int = scala.quoted.runtime.Patterns.patternHole[scala.Int] () } -Result: Some(List(Expr(45))) +Result: Some(List(Value(45))) Scrutinee: { def a(x: scala.Int): scala.Int = 45 @@ -639,14 +639,14 @@ Pattern: { @scala.quoted.runtime.Patterns.patternType type T scala.quoted.runtime.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, T]]) } -Result: Some(List(Type(scala.Unit), Expr(scala.List.apply[scala.Int](1, 2, 3)), Expr(((x: scala.Int) => scala.Predef.println(x))))) +Result: Some(List(Type(scala.Unit), Value(scala.List.apply[scala.Int](1, 2, 3)), Value(((x: scala.Int) => scala.Predef.println(x))))) Scrutinee: scala.List.apply[scala.Int](1, 2, 3).foreach[scala.Unit](((x: scala.Int) => scala.Predef.println(x))) Pattern: { @scala.quoted.runtime.Patterns.patternType type T = scala.Unit scala.quoted.runtime.Patterns.patternHole[scala.List[scala.Int]].foreach[T](scala.quoted.runtime.Patterns.patternHole[scala.Function1[scala.Int, T]]) } -Result: Some(List(Type(scala.Unit), Expr(scala.List.apply[scala.Int](1, 2, 3)), Expr(((x: scala.Int) => scala.Predef.println(x))))) +Result: Some(List(Type(scala.Unit), Value(scala.List.apply[scala.Int](1, 2, 3)), Value(((x: scala.Int) => scala.Predef.println(x))))) Scrutinee: scala.List.apply[scala.Int](1, 2, 3).foreach[scala.Unit](((x: scala.Int) => scala.Predef.println(x))) Pattern: { @@ -666,7 +666,7 @@ Pattern: { val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } -Result: Some(List(Type(scala.Int), Expr(4), Expr(4))) +Result: Some(List(Type(scala.Int), Value(4), Value(4))) Scrutinee: { val a: scala.Int = 4 @@ -679,7 +679,7 @@ Pattern: { val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } -Result: Some(List(Type(scala.Int), Expr(4), Expr(5))) +Result: Some(List(Type(scala.Int), Value(4), Value(5))) Scrutinee: { val a: scala.Int = 4 @@ -692,7 +692,7 @@ Pattern: { val b: T = scala.quoted.runtime.Patterns.patternHole[T] () } -Result: Some(List(Type(scala.Int | java.lang.String), Expr(4), Expr("x"))) +Result: Some(List(Type(scala.Int | java.lang.String), Value(4), Value("x"))) Scrutinee: { val a: scala.Int = 4 @@ -715,7 +715,7 @@ Pattern: { (scala.quoted.runtime.Patterns.patternHole[scala.List[T]].map[U](scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, U]]).map[V](scala.quoted.runtime.Patterns.patternHole[scala.Function1[U, V]]): scala.collection.immutable.List[scala.Any]) } -Result: Some(List(Type(scala.Int), Type(scala.Double), Type(java.lang.String), Expr(scala.List.apply[scala.Int](1, 2, 3)), Expr(((x: scala.Int) => x.toDouble./(2))), Expr(((y: scala.Double) => y.toString())))) +Result: Some(List(Type(scala.Int), Type(scala.Double), Type(java.lang.String), Value(scala.List.apply[scala.Int](1, 2, 3)), Value(((x: scala.Int) => x.toDouble./(2))), Value(((y: scala.Double) => y.toString())))) Scrutinee: ((x: scala.Int) => x) Pattern: { @@ -723,7 +723,7 @@ Pattern: { (scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) } -Result: Some(List(Type(scala.Int), Expr(((x: scala.Int) => x)))) +Result: Some(List(Type(scala.Int), Value(((x: scala.Int) => x)))) Scrutinee: ((x: scala.Int) => x.toString()) Pattern: { @@ -739,7 +739,7 @@ Pattern: { (scala.quoted.runtime.Patterns.patternHole[scala.Function1[T, T]]: scala.Function1[scala.Nothing, scala.Any]) } -Result: Some(List(Type(scala.Nothing), Expr(((x: scala.Any) => scala.Predef.???)))) +Result: Some(List(Type(scala.Nothing), Value(((x: scala.Any) => scala.Predef.???)))) Scrutinee: ((x: scala.Nothing) => (1: scala.Any)) Pattern: { diff --git a/tests/run-macros/quote-matcher-runtime/quoted_1.scala b/tests/run-macros/quote-matcher-runtime/quoted_1.scala index 000a5f8ba232..e0c0925610c7 100644 --- a/tests/run-macros/quote-matcher-runtime/quoted_1.scala +++ b/tests/run-macros/quote-matcher-runtime/quoted_1.scala @@ -10,16 +10,16 @@ object Macros { val res = quotes.asInstanceOf[scala.quoted.runtime.QuoteMatching].ExprMatch.unapply[Tuple, Tuple](a)(using b).map { tup => tup.toArray.toList.map { case r: Expr[_] => - s"Expr(${r.show})" + s"Value(${r.show})" case t: Type[_] => s"Type(${Type.show(using t)})" } } '{ - println("Scrutinee: " + ${Expr(Term.of(a).show)}) - println("Pattern: " + ${Expr(Term.of(b).show)}) - println("Result: " + ${Expr(res.toString)}) + println("Scrutinee: " + ${Value(Term.of(a).show)}) + println("Pattern: " + ${Value(Term.of(b).show)}) + println("Result: " + ${Value(res.toString)}) println() } } diff --git a/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala b/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala index 8660cdc7575b..e9ca843f2534 100644 --- a/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala @@ -11,7 +11,7 @@ object Macros { case ('{ StringContext(${Varargs(parts)}: _*) }, Varargs(args1)) => val strParts = parts.map(_.valueOrError.reverse) val strArgs = args1.map(_.valueOrError) - Expr(StringContext(strParts: _*).s(strArgs: _*)) + Value(StringContext(strParts: _*).s(strArgs: _*)) case _ => ??? } diff --git a/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala b/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala index 8c51f0d89480..37ad32687f22 100644 --- a/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala @@ -10,7 +10,7 @@ object Macros { self match { case '{ StringContext(${Varargs(Consts(parts))}: _*) } => val upprerParts: List[String] = parts.toList.map(_.toUpperCase) - val upprerPartsExpr: Expr[List[String]] = Expr.ofList(upprerParts.map(Expr(_))) + val upprerPartsExpr: Expr[List[String]] = Expr.ofList(upprerParts.map(Value(_))) '{ StringContext($upprerPartsExpr: _*).s($args: _*) } case _ => '{ diff --git a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala index 3859f395866b..261ff6e7bf34 100644 --- a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala @@ -11,7 +11,7 @@ object Macros { def lift(e: Expr[DSL]): Expr[T] = e match { case '{ LitDSL(${ Const(c) }) } => - '{ $sym.value(${Expr(c)}) } + '{ $sym.value(${Value(c)}) } case '{ ($x: DSL) + ($y: DSL) } => '{ $sym.plus(${lift(x)}, ${lift(y)}) } diff --git a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala index 1211f35f42e4..a6c27a090168 100644 --- a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala @@ -88,7 +88,7 @@ object UnsafeExpr { def freshEnvVar()(using Quotes): (Int, Expr[DSL]) = { v += 1 - (v, '{envVar(${Expr(v)})}) + (v, '{envVar(${Value(v)})}) } var v = 0 def envVar(i: Int): DSL = ??? @@ -116,7 +116,7 @@ trait Symantics[Num] { } object StringNum extends Symantics[String] { - def value(x: Int)(using Quotes): Expr[String] = Expr(x.toString) + def value(x: Int)(using Quotes): Expr[String] = Value(x.toString) def plus(x: Expr[String], y: Expr[String])(using Quotes): Expr[String] = '{ s"${$x} + ${$y}" } // '{ x + " + " + y } def times(x: Expr[String], y: Expr[String])(using Quotes): Expr[String] = '{ s"${$x} * ${$y}" } def app(f: Expr[String => String], x: Expr[String])(using Quotes): Expr[String] = Expr.betaReduce('{ $f($x) }) @@ -124,7 +124,7 @@ object StringNum extends Symantics[String] { } object ComputeNum extends Symantics[Int] { - def value(x: Int)(using Quotes): Expr[Int] = Expr(x) + def value(x: Int)(using Quotes): Expr[Int] = Value(x) def plus(x: Expr[Int], y: Expr[Int])(using Quotes): Expr[Int] = '{ $x + $y } def times(x: Expr[Int], y: Expr[Int])(using Quotes): Expr[Int] = '{ $x * $y } def app(f: Expr[Int => Int], x: Expr[Int])(using Quotes): Expr[Int] = '{ $f($x) } @@ -132,7 +132,7 @@ object ComputeNum extends Symantics[Int] { } object ASTNum extends Symantics[ASTNum] { - def value(x: Int)(using Quotes): Expr[ASTNum] = '{ LitAST(${Expr(x)}) } + def value(x: Int)(using Quotes): Expr[ASTNum] = '{ LitAST(${Value(x)}) } def plus(x: Expr[ASTNum], y: Expr[ASTNum])(using Quotes): Expr[ASTNum] = '{ PlusAST($x, $y) } def times(x: Expr[ASTNum], y: Expr[ASTNum])(using Quotes): Expr[ASTNum] = '{ TimesAST($x, $y) } def app(f: Expr[ASTNum => ASTNum], x: Expr[ASTNum])(using Quotes): Expr[ASTNum] = '{ AppAST($f, $x) } diff --git a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala index 8951f84963cb..3cf9cfe91dda 100644 --- a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala @@ -25,8 +25,8 @@ object Macros { } def lift[T: Type](e: Expr[T])(using env: Env): Expr[R[T]] = ((e: Expr[Any]) match { - case Const(e: Int) => '{ $sym.int(${Expr(e)}).asInstanceOf[R[T]] } - case Const(e: Boolean) => '{ $sym.bool(${Expr(e)}).asInstanceOf[R[T]] } + case Const(e: Int) => '{ $sym.int(${Value(e)}).asInstanceOf[R[T]] } + case Const(e: Boolean) => '{ $sym.bool(${Value(e)}).asInstanceOf[R[T]] } case '{ ($x: Int) + ($y: Int) } => '{ $sym.add(${lift(x)}, ${lift(y)}).asInstanceOf[R[T]] } @@ -101,7 +101,7 @@ object UnsafeExpr { def freshEnvVar[T: Type]()(using Quotes): (Int, Expr[T]) = { v += 1 - (v, '{envVar[T](${Expr(v)})}) + (v, '{envVar[T](${Value(v)})}) } var v = 0 def envVar[T](i: Int): T = ??? diff --git a/tests/run-macros/quote-matching-open/Macro_1.scala b/tests/run-macros/quote-matching-open/Macro_1.scala index 1d31d0ccc824..913e578d364e 100644 --- a/tests/run-macros/quote-matching-open/Macro_1.scala +++ b/tests/run-macros/quote-matching-open/Macro_1.scala @@ -6,9 +6,9 @@ object Macro { def impl(x: Expr[Any])(using Quotes): Expr[Any] = { x match { - case '{ (x: Int) => $body(x): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Expr(2)) } - case '{ (x1: Int, x2: Int) => $body(x1, x2): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Expr(2), Expr(3)) } - case '{ (x1: Int, x2: Int, x3: Int) => $body(x1, x2, x3): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Expr(2), Expr(3), Expr(4)) } + case '{ (x: Int) => $body(x): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Value(2)) } + case '{ (x1: Int, x2: Int) => $body(x1, x2): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Value(2), Value(3)) } + case '{ (x1: Int, x2: Int, x3: Int) => $body(x1, x2, x3): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Value(2), Value(3), Value(4)) } } } diff --git a/tests/run-macros/quote-matching-optimize-1/Macro_1.scala b/tests/run-macros/quote-matching-optimize-1/Macro_1.scala index 6909771f7f2f..eee3206315d4 100644 --- a/tests/run-macros/quote-matching-optimize-1/Macro_1.scala +++ b/tests/run-macros/quote-matching-optimize-1/Macro_1.scala @@ -23,8 +23,8 @@ object Macro { '{ val result = $res - val originalCode = ${Expr(x.show)} - val optimizeCode = ${Expr(res.show)} + val originalCode = ${Value(x.show)} + val optimizeCode = ${Value(res.show)} println("Original: " + originalCode) println("Optimized: " + optimizeCode) println("Result: " + result) diff --git a/tests/run-macros/quote-matching-optimize-2/Macro_1.scala b/tests/run-macros/quote-matching-optimize-2/Macro_1.scala index 89f52713c106..8003a850e97c 100644 --- a/tests/run-macros/quote-matching-optimize-2/Macro_1.scala +++ b/tests/run-macros/quote-matching-optimize-2/Macro_1.scala @@ -23,8 +23,8 @@ object Macro { '{ val result = $res - val originalCode = ${Expr(x.show)} - val optimizeCode = ${Expr(res.show)} + val originalCode = ${Value(x.show)} + val optimizeCode = ${Value(res.show)} println("Original: " + originalCode) println("Optimized: " + optimizeCode) println("Result: " + result) diff --git a/tests/run-macros/quote-matching-optimize-3/Macro_1.scala b/tests/run-macros/quote-matching-optimize-3/Macro_1.scala index 7aefe30d20dd..d923b5a17312 100644 --- a/tests/run-macros/quote-matching-optimize-3/Macro_1.scala +++ b/tests/run-macros/quote-matching-optimize-3/Macro_1.scala @@ -23,8 +23,8 @@ object Macro { '{ val result = $res - val originalCode = ${Expr(x.show)} - val optimizeCode = ${Expr(res.show)} + val originalCode = ${Value(x.show)} + val optimizeCode = ${Value(res.show)} println("Original: " + originalCode) println("Optimized: " + optimizeCode) println("Result: " + result) diff --git a/tests/run-macros/quote-simple-macro/quoted_1.scala b/tests/run-macros/quote-simple-macro/quoted_1.scala index 0bc43021a8a6..3bb86d2579ad 100644 --- a/tests/run-macros/quote-simple-macro/quoted_1.scala +++ b/tests/run-macros/quote-simple-macro/quoted_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macros { inline def foo(inline i: Int, dummy: Int, j: Int): Int = ${ bar('i, 'j) } - def bar(x: Expr[Int], y: Expr[Int]) (using Quotes): Expr[Int] = '{ ${Expr(x.valueOrError)} + $y } + def bar(x: Expr[Int], y: Expr[Int]) (using Quotes): Expr[Int] = '{ ${Value(x.valueOrError)} + $y } } diff --git a/tests/run-macros/quote-type-matcher-2/quoted_1.scala b/tests/run-macros/quote-type-matcher-2/quoted_1.scala index 4decd9a65ac4..f15f2f897cbe 100644 --- a/tests/run-macros/quote-type-matcher-2/quoted_1.scala +++ b/tests/run-macros/quote-type-matcher-2/quoted_1.scala @@ -12,7 +12,7 @@ object Macros { case '[Function1[t, u]] => s"%${lift[t]} => ${lift[u]}%" case _ => Type.show[T] } - Expr(lift[A]) + Value(lift[A]) } } diff --git a/tests/run-macros/quote-type-matcher/quoted_1.scala b/tests/run-macros/quote-type-matcher/quoted_1.scala index dd382deb3dd8..8c5799da9b46 100644 --- a/tests/run-macros/quote-type-matcher/quoted_1.scala +++ b/tests/run-macros/quote-type-matcher/quoted_1.scala @@ -15,9 +15,9 @@ object Macros { } '{ - println("Scrutinee: " + ${Expr(TypeTree.of[A].show)}) - println("Pattern: " + ${Expr(TypeTree.of[B].show)}) - println("Result: " + ${Expr(res.toString)}) + println("Scrutinee: " + ${Value(TypeTree.of[A].show)}) + println("Pattern: " + ${Value(TypeTree.of[B].show)}) + println("Result: " + ${Value(res.toString)}) println() } } diff --git a/tests/run-macros/quote-unrolled-foreach/quoted_1.scala b/tests/run-macros/quote-unrolled-foreach/quoted_1.scala index b218f135fe9f..9dcce7331c6a 100644 --- a/tests/run-macros/quote-unrolled-foreach/quoted_1.scala +++ b/tests/run-macros/quote-unrolled-foreach/quoted_1.scala @@ -11,17 +11,17 @@ object Macro { private def unrolledForeachImpl(unrollSize: Int, seq: Expr[Array[Int]], f: Expr[Int => Unit])(using Quotes): Expr[Unit] = '{ val size = $seq.length - assert(size % (${Expr(unrollSize)}) == 0) // for simplicity of the implementation + assert(size % (${Value(unrollSize)}) == 0) // for simplicity of the implementation var i = 0 while (i < size) { println(" start loop") ${ @tailrec def loop(j: Int, acc: Expr[Unit]): Expr[Unit] = - if (j >= 0) loop(j - 1, '{ ${Expr.betaReduce('{$f($seq(i + ${Expr(j)}))})}; $acc }) + if (j >= 0) loop(j - 1, '{ ${Expr.betaReduce('{$f($seq(i + ${Value(j)}))})}; $acc }) else acc loop(unrollSize - 1, '{}) } - i += ${Expr(unrollSize)} + i += ${Value(unrollSize)} } } } diff --git a/tests/run-macros/quoted-matching-docs-2/Macro_1.scala b/tests/run-macros/quoted-matching-docs-2/Macro_1.scala index cb8ceb59fe66..fdaff27a8542 100644 --- a/tests/run-macros/quoted-matching-docs-2/Macro_1.scala +++ b/tests/run-macros/quoted-matching-docs-2/Macro_1.scala @@ -7,11 +7,11 @@ inline def showOptimize(inline arg: Int): String = ${ showOptimizeExpr('arg) } inline def optimize(inline arg: Int): Int = ${ optimizeExpr('arg) } private def showOptimizeExpr(body: Expr[Int])(using Quotes): Expr[String] = - Expr(optimizeExpr(body).show) + Value(optimizeExpr(body).show) private def optimizeExpr(body: Expr[Int])(using Quotes): Expr[Int] = body match { // Match a call to sum without any arguments - case '{ sum() } => Expr(0) + case '{ sum() } => Value(0) // Match a call to sum with an argument $n of type Int. n will be the Expr[Int] representing the argument. case '{ sum($n) } => n // Match a call to sum and extracts all its args in an `Expr[Seq[Int]]` @@ -27,5 +27,5 @@ private def sumExpr(args1: Seq[Expr[Int]])(using Quotes): Expr[Int] = { val args2 = args1.flatMap(flatSumArgs) val staticSum: Int = args2.map(_.value.getOrElse(0)).sum val dynamicSum: Seq[Expr[Int]] = args2.filter(_.value.isEmpty) - dynamicSum.foldLeft(Expr(staticSum))((acc, arg) => '{ $acc + $arg }) + dynamicSum.foldLeft(Value(staticSum))((acc, arg) => '{ $acc + $arg }) } diff --git a/tests/run-macros/quoted-matching-docs/Macro_1.scala b/tests/run-macros/quoted-matching-docs/Macro_1.scala index bd4423e99fd8..7bd22b1f98ef 100644 --- a/tests/run-macros/quoted-matching-docs/Macro_1.scala +++ b/tests/run-macros/quoted-matching-docs/Macro_1.scala @@ -5,16 +5,16 @@ inline def sum(args: Int*): Int = ${ sumExpr('args) } inline def sumShow(args: Int*): String = ${ sumExprShow('args) } private def sumExprShow(argsExpr: Expr[Seq[Int]]) (using Quotes): Expr[String] = - Expr(sumExpr(argsExpr).show) + Value(sumExpr(argsExpr).show) private def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes) : Expr[Int] = { UnsafeExpr.underlyingArgument(argsExpr) match { case Varargs(Consts(args)) => // args is of type Seq[Int] - Expr(args.sum) // precompute result of sum + Value(args.sum) // precompute result of sum case Varargs(argExprs) => // argExprs is of type Seq[Expr[Int]] val staticSum: Int = argExprs.map(_.value.getOrElse(0)).sum val dynamicSum: Seq[Expr[Int]] = argExprs.filter(_.value.isEmpty) - dynamicSum.foldLeft(Expr(staticSum))((acc, arg) => '{ $acc + $arg }) + dynamicSum.foldLeft(Value(staticSum))((acc, arg) => '{ $acc + $arg }) case _ => '{ $argsExpr.sum } } diff --git a/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala b/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala index 9f5fdc044415..b9933fc409cb 100644 --- a/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala @@ -4,6 +4,6 @@ inline def test(inline e: Int): String = ${testExpr('e)} private def testExpr(e: Expr[Int])(using Quotes): Expr[String] = { e match { - case '{ val y: Int = 4; $body(y): Int } => Expr("Matched open\n" + body.show) + case '{ val y: Int = 4; $body(y): Int } => Value("Matched open\n" + body.show) } } diff --git a/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala b/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala index 096911841e9a..368edba6040b 100644 --- a/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala @@ -8,7 +8,7 @@ private def evalExpr(using Quotes)(e: Expr[Int]): Expr[Int] = { evalExpr(Expr.betaReduce('{$body(${evalExpr(x)})})) case '{ ($x: Int) * ($y: Int) } => (x.value, y.value) match - case (Some(a), Some(b)) => Expr(a * b) + case (Some(a), Some(b)) => Value(a * b) case _ => e case _ => e } diff --git a/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala b/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala index 3416c9379ca5..bb969033c4ab 100644 --- a/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala @@ -4,9 +4,9 @@ inline def test(inline e: Int): String = ${testExpr('e)} private def testExpr(e: Expr[Int])(using Quotes): Expr[String] = { e match { - case '{ val y: Int = 4; $body } => Expr("Matched closed\n" + body.show) - case '{ val y: Int = 4; $body(y): Int } => Expr("Matched open\n" + body.show) - case '{ val y: Int => Int = x => x + 1; $body(y): Int } => Expr("Matched open\n" + body.show) - case '{ def g(x: Int): Int = $body(g, x); g(5) } => Expr("Matched open\n" + body.show) + case '{ val y: Int = 4; $body } => Value("Matched closed\n" + body.show) + case '{ val y: Int = 4; $body(y): Int } => Value("Matched open\n" + body.show) + case '{ val y: Int => Int = x => x + 1; $body(y): Int } => Value("Matched open\n" + body.show) + case '{ def g(x: Int): Int = $body(g, x); g(5) } => Value("Matched open\n" + body.show) } } diff --git a/tests/run-macros/refined-selectable-macro/Macro_1.scala b/tests/run-macros/refined-selectable-macro/Macro_1.scala index ab89c080a4f6..68642bad3d68 100644 --- a/tests/run-macros/refined-selectable-macro/Macro_1.scala +++ b/tests/run-macros/refined-selectable-macro/Macro_1.scala @@ -37,7 +37,7 @@ object Macro { } def tupleElem(name: String, info: TypeRepr): Expr[Any] = { - val nameExpr = Expr(name) + val nameExpr = Value(name) info.asType match { case '[t] => Expr.ofTupleFromSeq(Seq(nameExpr, '{ $s.selectDynamic($nameExpr).asInstanceOf[t] })) } diff --git a/tests/run-macros/reflect-inline/assert_1.scala b/tests/run-macros/reflect-inline/assert_1.scala index d6b115529ea6..38544a77891a 100644 --- a/tests/run-macros/reflect-inline/assert_1.scala +++ b/tests/run-macros/reflect-inline/assert_1.scala @@ -5,12 +5,12 @@ object api { ${ stripImpl('x) } private def stripImpl(x: Expr[String])(using Quotes): Expr[String] = - Expr(augmentString(x.valueOrError).stripMargin) + Value(augmentString(x.valueOrError).stripMargin) inline def typeChecks(inline x: String): Boolean = ${ typeChecksImpl('{scala.compiletime.testing.typeChecks(x)}) } private def typeChecksImpl(b: Expr[Boolean])(using Quotes): Expr[Boolean] = { - if (b.valueOrError) Expr(true) else Expr(false) + if (b.valueOrError) Value(true) else Value(false) } } diff --git a/tests/run-macros/reflect-sourceCode/Macro_1.scala b/tests/run-macros/reflect-sourceCode/Macro_1.scala index 8a9173ad01ad..7b0f608fa1ac 100644 --- a/tests/run-macros/reflect-sourceCode/Macro_1.scala +++ b/tests/run-macros/reflect-sourceCode/Macro_1.scala @@ -6,6 +6,6 @@ object api { private def reflImpl[T](x: Expr[T])(implicit qctx: Quotes): Expr[String] = { import quotes.reflect._ - Expr(Term.of(x).pos.sourceCode.get) + Value(Term.of(x).pos.sourceCode.get) } } diff --git a/tests/run-macros/reflect-typeChecks/assert_1.scala b/tests/run-macros/reflect-typeChecks/assert_1.scala index db8d4fe3dd31..5c4d1a55c909 100644 --- a/tests/run-macros/reflect-typeChecks/assert_1.scala +++ b/tests/run-macros/reflect-typeChecks/assert_1.scala @@ -6,6 +6,6 @@ object scalatest { inline def assertNotCompile(inline code: String): Unit = ${ assertImpl('code, '{compiletime.testing.typeChecks(code)}, false) } def assertImpl(code: Expr[String], actual: Expr[Boolean], expect: Boolean)(using Quotes) : Expr[Unit] = { - '{ assert(${Expr(expect)} == $actual) } + '{ assert(${Value(expect)} == $actual) } } } diff --git a/tests/run-macros/requiredSymbols/Macro_1.scala b/tests/run-macros/requiredSymbols/Macro_1.scala index 8a516081a80a..dd6ba5459073 100644 --- a/tests/run-macros/requiredSymbols/Macro_1.scala +++ b/tests/run-macros/requiredSymbols/Macro_1.scala @@ -22,6 +22,6 @@ object Macro { Symbol.requiredMethod("scala.List.empty"), ) - Expr(list.map(_.fullName).mkString("\n")) + Value(list.map(_.fullName).mkString("\n")) } } diff --git a/tests/run-macros/tasty-argument-tree-1/quoted_1.scala b/tests/run-macros/tasty-argument-tree-1/quoted_1.scala index 2199d589af85..98c24dfafb3f 100644 --- a/tests/run-macros/tasty-argument-tree-1/quoted_1.scala +++ b/tests/run-macros/tasty-argument-tree-1/quoted_1.scala @@ -9,8 +9,8 @@ object Macros { val tree = Term.of(x) '{ println() - println("tree: " + ${Expr(tree.showExtractors)}) - println("tree deref. vals: " + ${Expr(tree.underlying.showExtractors)}) + println("tree: " + ${Value(tree.showExtractors)}) + println("tree deref. vals: " + ${Value(tree.underlying.showExtractors)}) } } } diff --git a/tests/run-macros/tasty-dealias/quoted_1.scala b/tests/run-macros/tasty-dealias/quoted_1.scala index 7e77ea345572..063eb9766f9f 100644 --- a/tests/run-macros/tasty-dealias/quoted_1.scala +++ b/tests/run-macros/tasty-dealias/quoted_1.scala @@ -6,6 +6,6 @@ object Macros { def impl[T: Type](using Quotes) : Expr[String] = { import quotes.reflect._ - Expr(TypeRepr.of[T].dealias.show) + Value(TypeRepr.of[T].dealias.show) } } diff --git a/tests/run-macros/tasty-definitions-1/quoted_1.scala b/tests/run-macros/tasty-definitions-1/quoted_1.scala index 514e858bde63..31838fde1b6d 100644 --- a/tests/run-macros/tasty-definitions-1/quoted_1.scala +++ b/tests/run-macros/tasty-definitions-1/quoted_1.scala @@ -91,7 +91,7 @@ object Macros { printout(TypeRepr.of[String].showExtractors) - '{println(${Expr(buff.result().mkString("\n"))})} + '{println(${Value(buff.result().mkString("\n"))})} } } diff --git a/tests/run-macros/tasty-eval/quoted_1.scala b/tests/run-macros/tasty-eval/quoted_1.scala index 1d7f07a06ed0..4c1693fc015c 100644 --- a/tests/run-macros/tasty-eval/quoted_1.scala +++ b/tests/run-macros/tasty-eval/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { ${ impl('i) } def impl(i: Expr[Int]) (using Quotes): Expr[String] = { - Expr(value(i).toString) + Value(value(i).toString) } inline implicit def value[X](e: Expr[X])(implicit qctx: Quotes, ev: Valuable[X]): Option[X] = ev.value(e) diff --git a/tests/run-macros/tasty-extractors-1/quoted_1.scala b/tests/run-macros/tasty-extractors-1/quoted_1.scala index 2c637095e9ae..1a9905b3e0bf 100644 --- a/tests/run-macros/tasty-extractors-1/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-1/quoted_1.scala @@ -9,8 +9,8 @@ object Macros { import quotes.reflect._ val tree = Term.of(x) - val treeStr = Expr(tree.showExtractors) - val treeTpeStr = Expr(tree.tpe.showExtractors) + val treeStr = Value(tree.showExtractors) + val treeTpeStr = Value(tree.tpe.showExtractors) '{ println(${treeStr}) diff --git a/tests/run-macros/tasty-extractors-2/quoted_1.scala b/tests/run-macros/tasty-extractors-2/quoted_1.scala index 208405eedb61..951ad15b2ec0 100644 --- a/tests/run-macros/tasty-extractors-2/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-2/quoted_1.scala @@ -10,8 +10,8 @@ object Macros { val tree = Term.of(x) - val treeStr = Expr(tree.showExtractors) - val treeTpeStr = Expr(tree.tpe.showExtractors) + val treeStr = Value(tree.showExtractors) + val treeTpeStr = Value(tree.tpe.showExtractors) '{ println(${treeStr}) diff --git a/tests/run-macros/tasty-extractors-3/quoted_1.scala b/tests/run-macros/tasty-extractors-3/quoted_1.scala index dca1daab8c4c..20bac321016a 100644 --- a/tests/run-macros/tasty-extractors-3/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-3/quoted_1.scala @@ -27,6 +27,6 @@ object Macros { val tree = Term.of(x) traverser.traverseTree(tree)(Symbol.spliceOwner) - '{print(${Expr(buff.result())})} + '{print(${Value(buff.result())})} } } diff --git a/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala b/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala index 8f53d7a39e3c..889fa3da6384 100644 --- a/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala @@ -11,13 +11,13 @@ object Macros { val buff = new StringBuilder def stagedPrintln(x: Any): Unit = buff append java.util.Objects.toString(x) append "\n" - Expr(3) match { case Const(n) => stagedPrintln(n) } + Value(3) match { case Const(n) => stagedPrintln(n) } '{4} match { case Const(n) => stagedPrintln(n) } '{"abc"} match { case Const(n) => stagedPrintln(n) } '{null} match { case '{null} => stagedPrintln(null) } '{new Object} match { case Const(n) => println(n); case _ => stagedPrintln("OK") } - '{print(${Expr(buff.result())})} + '{print(${Value(buff.result())})} } } diff --git a/tests/run-macros/tasty-extractors-types/quoted_1.scala b/tests/run-macros/tasty-extractors-types/quoted_1.scala index 24d79198cf08..d3a556a0def2 100644 --- a/tests/run-macros/tasty-extractors-types/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-types/quoted_1.scala @@ -7,8 +7,8 @@ object Macros { def impl[T: Type](using Quotes) : Expr[Unit] = { import quotes.reflect._ '{ - println(${Expr(TypeTree.of[T].showExtractors)}) - println(${Expr(TypeRepr.of[T].showExtractors)}) + println(${Value(TypeTree.of[T].showExtractors)}) + println(${Value(TypeRepr.of[T].showExtractors)}) println() } } diff --git a/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala b/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala index 6fc28ac4403f..3dd9d7973ea9 100644 --- a/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala +++ b/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala @@ -9,6 +9,6 @@ object SourceFiles { def getThisFileImpl: Macro[String] = val q = quotes // Quotes is ByName and hence not stable (q stabilizes it) - Expr(q.reflect.SourceFile.current.jpath.getFileName.toString) + Value(q.reflect.SourceFile.current.jpath.getFileName.toString) } diff --git a/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala b/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala index eab7808ac0fb..9ec86ee3cbd5 100644 --- a/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala +++ b/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala @@ -10,7 +10,7 @@ object SourceFiles { def getThisFileImpl: Macro[String] = { val qctx = tastyContext - Expr(qctx.reflect.SourceFile.current.jpath.getFileName.toString) + Value(qctx.reflect.SourceFile.current.jpath.getFileName.toString) } } diff --git a/tests/run-macros/tasty-getfile/Macro_1.scala b/tests/run-macros/tasty-getfile/Macro_1.scala index 5e9ccb58e1f0..b81db5daf2a5 100644 --- a/tests/run-macros/tasty-getfile/Macro_1.scala +++ b/tests/run-macros/tasty-getfile/Macro_1.scala @@ -7,6 +7,6 @@ object SourceFiles { ${getThisFileImpl} private def getThisFileImpl(using Quotes) : Expr[String] = - Expr(quotes.reflect.SourceFile.current.jpath.getFileName.toString) + Value(quotes.reflect.SourceFile.current.jpath.getFileName.toString) } diff --git a/tests/run-macros/tasty-indexed-map/quoted_1.scala b/tests/run-macros/tasty-indexed-map/quoted_1.scala index 64e7472c3a7e..723c67a181ce 100644 --- a/tests/run-macros/tasty-indexed-map/quoted_1.scala +++ b/tests/run-macros/tasty-indexed-map/quoted_1.scala @@ -41,6 +41,6 @@ object Index { val index = keys.indexOf(key) - '{new Index(${Expr(index)})} + '{new Index(${Value(index)})} } } diff --git a/tests/run-macros/tasty-interpolation-1/Macro.scala b/tests/run-macros/tasty-interpolation-1/Macro.scala index e8be14e75d97..77a03751e246 100644 --- a/tests/run-macros/tasty-interpolation-1/Macro.scala +++ b/tests/run-macros/tasty-interpolation-1/Macro.scala @@ -14,17 +14,17 @@ object Macro { object SIntepolator extends MacroStringInterpolator[String] { protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using Quotes): Expr[String] = - '{(${Expr(strCtx)}).s(${Expr.ofList(args)}: _*)} + '{(${Value(strCtx)}).s(${Expr.ofList(args)}: _*)} } object RawIntepolator extends MacroStringInterpolator[String] { protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using Quotes): Expr[String] = - '{(${Expr(strCtx)}).raw(${Expr.ofList(args)}: _*)} + '{(${Value(strCtx)}).raw(${Expr.ofList(args)}: _*)} } object FooIntepolator extends MacroStringInterpolator[String] { protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using Quotes): Expr[String] = - '{(${Expr(strCtx)}).s(${Expr.ofList(args.map(_ => '{"foo"}))}: _*)} + '{(${Value(strCtx)}).s(${Expr.ofList(args.map(_ => '{"foo"}))}: _*)} } // TODO put this class in the stdlib or separate project? @@ -77,7 +77,7 @@ abstract class MacroStringInterpolator[T] { } protected implicit def StringContextIsToExpr: ToExpr[StringContext] = new ToExpr[StringContext] { - def apply(strCtx: StringContext)(using Quotes) = '{StringContext(${Expr(strCtx.parts.toSeq)}: _*)} + def apply(strCtx: StringContext)(using Quotes) = '{StringContext(${Value(strCtx.parts.toSeq)}: _*)} } protected class NotStaticlyKnownError(msg: String, expr: Expr[Any]) extends Exception(msg) diff --git a/tests/run-macros/tasty-linenumber-2/quoted_1.scala b/tests/run-macros/tasty-linenumber-2/quoted_1.scala index 6205e871457b..734c836c80be 100644 --- a/tests/run-macros/tasty-linenumber-2/quoted_1.scala +++ b/tests/run-macros/tasty-linenumber-2/quoted_1.scala @@ -10,7 +10,7 @@ object LineNumber { def lineImpl(using Quotes) : Expr[LineNumber] = { import quotes.reflect._ - '{new LineNumber(${Expr(Position.ofMacroExpansion.startLine)})} + '{new LineNumber(${Value(Position.ofMacroExpansion.startLine)})} } } diff --git a/tests/run-macros/tasty-linenumber/quoted_1.scala b/tests/run-macros/tasty-linenumber/quoted_1.scala index c6d71a1c60e8..a16b6217cfe5 100644 --- a/tests/run-macros/tasty-linenumber/quoted_1.scala +++ b/tests/run-macros/tasty-linenumber/quoted_1.scala @@ -11,7 +11,7 @@ object LineNumber { def lineImpl(x: Type[Unit])(using Quotes) : Expr[LineNumber] = { import quotes.reflect._ - '{new LineNumber(${Expr(Position.ofMacroExpansion.startLine)})} + '{new LineNumber(${Value(Position.ofMacroExpansion.startLine)})} } } diff --git a/tests/run-macros/tasty-location/quoted_1.scala b/tests/run-macros/tasty-location/quoted_1.scala index ae84485437be..4ccebd80268a 100644 --- a/tests/run-macros/tasty-location/quoted_1.scala +++ b/tests/run-macros/tasty-location/quoted_1.scala @@ -14,7 +14,7 @@ object Location { else listOwnerNames(sym.owner, sym.name :: acc) val list = listOwnerNames(Symbol.spliceOwner, Nil) - '{new Location(${Expr(list)})} + '{new Location(${Value(list)})} } } diff --git a/tests/run-macros/tasty-macro-positions/quoted_1.scala b/tests/run-macros/tasty-macro-positions/quoted_1.scala index 9e20acbbf1c9..48878dec26a4 100644 --- a/tests/run-macros/tasty-macro-positions/quoted_1.scala +++ b/tests/run-macros/tasty-macro-positions/quoted_1.scala @@ -14,7 +14,7 @@ object Macros { val code = Term.of(x).underlyingArgument.show '{ println($pos) - println(${Expr(code)}) + println(${Value(code)}) } } @@ -24,12 +24,12 @@ object Macros { val code = TypeTree.of[T].show '{ println($pos) - println(${Expr(code)}) + println(${Value(code)}) } } def posStr(using Quotes)(pos: quotes.reflect.Position): Expr[String] = { import quotes.reflect._ - Expr(s"${pos.sourceFile.jpath.getFileName.toString}:[${pos.start}..${pos.end}]") + Value(s"${pos.sourceFile.jpath.getFileName.toString}:[${pos.start}..${pos.end}]") } } diff --git a/tests/run-macros/tasty-original-source/Macros_1.scala b/tests/run-macros/tasty-original-source/Macros_1.scala index 71bbb6c2dd80..afd11c4c997c 100644 --- a/tests/run-macros/tasty-original-source/Macros_1.scala +++ b/tests/run-macros/tasty-original-source/Macros_1.scala @@ -6,7 +6,7 @@ object Macros { private def impl(arg: Expr[Any])(using Quotes) : Expr[(String, Any)] = { import quotes.reflect._ - val source = Expr(Term.of(arg).underlyingArgument.pos.sourceCode.get.toString) + val source = Value(Term.of(arg).underlyingArgument.pos.sourceCode.get.toString) '{Tuple2($source, $arg)} } diff --git a/tests/run-macros/tasty-positioned/quoted_1.scala b/tests/run-macros/tasty-positioned/quoted_1.scala index 50c5c79911ae..ca958f57fa63 100644 --- a/tests/run-macros/tasty-positioned/quoted_1.scala +++ b/tests/run-macros/tasty-positioned/quoted_1.scala @@ -13,13 +13,13 @@ object Positioned { import quotes.reflect.{Position => Pos, _} val pos = Pos.ofMacroExpansion - val path = Expr(pos.sourceFile.jpath.toString) - val start = Expr(pos.start) - val end = Expr(pos.end) - val startLine = Expr(pos.startLine) - val endLine = Expr(pos.endLine) - val startColumn = Expr(pos.startColumn) - val endColumn = Expr(pos.endColumn) + val path = Value(pos.sourceFile.jpath.toString) + val start = Value(pos.start) + val end = Value(pos.end) + val startLine = Value(pos.startLine) + val endLine = Value(pos.endLine) + val startColumn = Value(pos.startColumn) + val endColumn = Value(pos.endColumn) val liftedPosition = '{new Position($path, $start, $end, $startLine, $startColumn, $endLine, $endColumn)} '{Positioned[T]($x, $liftedPosition)} diff --git a/tests/run-macros/tasty-simplified/quoted_1.scala b/tests/run-macros/tasty-simplified/quoted_1.scala index bf3b2e2287d8..f2bf8203339f 100644 --- a/tests/run-macros/tasty-simplified/quoted_1.scala +++ b/tests/run-macros/tasty-simplified/quoted_1.scala @@ -19,6 +19,6 @@ object Macros { } val tps = unpackTuple(TypeRepr.of[T]) - Varargs(tps.map(x => Expr(x.show))) + Varargs(tps.map(x => Value(x.show))) } } diff --git a/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala b/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala index 509b55acb397..ee7807ef7157 100644 --- a/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala +++ b/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala @@ -39,7 +39,7 @@ object Macro { def errorOnPart(msg: String, partIdx: Int): Unit = { import quotes.reflect._ val pos = Term.of(parts(partIdx)).pos - errors += '{ Tuple4(${Expr(partIdx)}, ${Expr(pos.start)}, ${Expr(pos.end)}, ${Expr(msg)}) } + errors += '{ Tuple4(${Value(partIdx)}, ${Value(pos.start)}, ${Value(pos.end)}, ${Value(msg)}) } } } fooCore(parts, args, reporter) // Discard result diff --git a/tests/run-macros/tasty-subtyping/quoted_1.scala b/tests/run-macros/tasty-subtyping/quoted_1.scala index 3622d1277f54..59bcbf3cee9c 100644 --- a/tests/run-macros/tasty-subtyping/quoted_1.scala +++ b/tests/run-macros/tasty-subtyping/quoted_1.scala @@ -11,12 +11,12 @@ object Macros { def isTypeEqualImpl[T: Type, U: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ val isTypeEqual = TypeRepr.of[T] =:= TypeRepr.of[U] - Expr(isTypeEqual) + Value(isTypeEqual) } def isSubTypeOfImpl[T: Type, U: Type](using Quotes) : Expr[Boolean] = { import quotes.reflect._ val isTypeEqual = TypeRepr.of[T] <:< TypeRepr.of[U] - Expr(isTypeEqual) + Value(isTypeEqual) } } diff --git a/tests/run-macros/tasty-typeof/Macro_1.scala b/tests/run-macros/tasty-typeof/Macro_1.scala index fdc54f5cd844..767fd19729d7 100644 --- a/tests/run-macros/tasty-typeof/Macro_1.scala +++ b/tests/run-macros/tasty-typeof/Macro_1.scala @@ -7,25 +7,25 @@ object Macros { private def testTypeOfImpl(using Quotes) : Expr[Unit] = { import quotes.reflect._ '{ - assert(${Expr(TypeRepr.of[Unit] =:= TypeRepr.of[Unit])}, "Unit") - assert(${Expr(TypeRepr.of[Byte] =:= TypeRepr.of[Byte])}, "Byte") - assert(${Expr(TypeRepr.of[Short] =:= TypeRepr.of[Short])}, "Short") - assert(${Expr(TypeRepr.of[Int] =:= TypeRepr.of[Int])}, "Int") - assert(${Expr(TypeRepr.of[Long] =:= TypeRepr.of[Long])}, "Long") - assert(${Expr(TypeRepr.of[Float] =:= TypeRepr.of[Float])}, "Float") - assert(${Expr(TypeRepr.of[Double] =:= TypeRepr.of[Double])}, "Double") - assert(${Expr(TypeRepr.of[Char] =:= TypeRepr.of[Char])}, "Char") - assert(${Expr(TypeRepr.of[String] =:= TypeRepr.of[String])}, "String") + assert(${Value(TypeRepr.of[Unit] =:= TypeRepr.of[Unit])}, "Unit") + assert(${Value(TypeRepr.of[Byte] =:= TypeRepr.of[Byte])}, "Byte") + assert(${Value(TypeRepr.of[Short] =:= TypeRepr.of[Short])}, "Short") + assert(${Value(TypeRepr.of[Int] =:= TypeRepr.of[Int])}, "Int") + assert(${Value(TypeRepr.of[Long] =:= TypeRepr.of[Long])}, "Long") + assert(${Value(TypeRepr.of[Float] =:= TypeRepr.of[Float])}, "Float") + assert(${Value(TypeRepr.of[Double] =:= TypeRepr.of[Double])}, "Double") + assert(${Value(TypeRepr.of[Char] =:= TypeRepr.of[Char])}, "Char") + assert(${Value(TypeRepr.of[String] =:= TypeRepr.of[String])}, "String") - assert(${Expr(TypeRepr.of[Any] =:= TypeRepr.of[Any])}, "Any") - assert(${Expr(TypeRepr.of[AnyRef] =:= TypeRepr.of[AnyRef])}, "AnyRef") - assert(${Expr(TypeRepr.of[AnyVal] =:= TypeRepr.of[AnyVal])}, "AnyVal") - assert(${Expr(TypeRepr.of[Object] =:= TypeRepr.of[Object])}, "Object") - assert(${Expr(TypeRepr.of[Nothing] =:= TypeRepr.of[Nothing])}, "Nothing") + assert(${Value(TypeRepr.of[Any] =:= TypeRepr.of[Any])}, "Any") + assert(${Value(TypeRepr.of[AnyRef] =:= TypeRepr.of[AnyRef])}, "AnyRef") + assert(${Value(TypeRepr.of[AnyVal] =:= TypeRepr.of[AnyVal])}, "AnyVal") + assert(${Value(TypeRepr.of[Object] =:= TypeRepr.of[Object])}, "Object") + assert(${Value(TypeRepr.of[Nothing] =:= TypeRepr.of[Nothing])}, "Nothing") - println(${Expr(TypeRepr.of[List[Int]].show)}) - println(${Expr(TypeRepr.of[Macros].show)}) - println(${Expr(TypeRepr.of[Macros.type].show)}) + println(${Value(TypeRepr.of[List[Int]].show)}) + println(${Value(TypeRepr.of[Macros].show)}) + println(${Value(TypeRepr.of[Macros.type].show)}) } } diff --git a/tests/run-macros/type-show/Macro_1.scala b/tests/run-macros/type-show/Macro_1.scala index c20f592dbfef..65ecc755ca66 100644 --- a/tests/run-macros/type-show/Macro_1.scala +++ b/tests/run-macros/type-show/Macro_1.scala @@ -3,5 +3,5 @@ import scala.quoted._ object TypeToolbox { inline def show[A]: String = ${ showImpl[A] } private def showImpl[A: Type](using Quotes) : Expr[String] = - Expr(Type.show[A]) + Value(Type.show[A]) } diff --git a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala index 4b6c89c8b215..e58111fad45f 100644 --- a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala @@ -56,6 +56,6 @@ object XmlQuote { val Typed(Repeated(args0, _), _) = Term.of(args).underlyingArgument val string = parts.mkString("??") - '{new Xml(${Expr(string)}, ${liftListOfAny(args0)})} + '{new Xml(${Value(string)}, ${liftListOfAny(args0)})} } } diff --git a/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala index 73d43f35e90d..2cde5b810ef6 100644 --- a/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala @@ -64,7 +64,7 @@ object XmlQuote { } - val string = Expr(parts.mkString("??")) + val string = Value(parts.mkString("??")) '{new Xml(${string}, $args2)} } } diff --git a/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala index 0dae5174e017..08a7df6c6d81 100644 --- a/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala @@ -13,6 +13,6 @@ object XmlQuote { def impl(receiver: Expr[StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver.valueOrError.parts.mkString("??") - '{new Xml(${Expr(string)}, $args.toList)} + '{new Xml(${Value(string)}, $args.toList)} } } diff --git a/tests/run-macros/xml-interpolation-5/Macros_1.scala b/tests/run-macros/xml-interpolation-5/Macros_1.scala index 889696b0335f..d7a1b69d04b9 100644 --- a/tests/run-macros/xml-interpolation-5/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-5/Macros_1.scala @@ -26,7 +26,7 @@ object XmlQuote { def impl(receiver: Expr[SCOps.StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver match { - case '{ SCOps(${Expr(sc)}) } => Expr(sc.parts.mkString("??")) + case '{ SCOps(${Value(sc)}) } => Value(sc.parts.mkString("??")) } '{new Xml(${string}, $args.toList)} } diff --git a/tests/run-macros/xml-interpolation-6/Macros_1.scala b/tests/run-macros/xml-interpolation-6/Macros_1.scala index f723a57123c1..97df44c76035 100644 --- a/tests/run-macros/xml-interpolation-6/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-6/Macros_1.scala @@ -26,8 +26,8 @@ object XmlQuote { def impl(receiver: Expr[SCOps.StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver match { - case '{ SCOps(${Expr(sc)}): SCOps.StringContext } => sc.parts.mkString("??") + case '{ SCOps(${Value(sc)}): SCOps.StringContext } => sc.parts.mkString("??") } - '{new Xml(${Expr(string)}, $args.toList)} + '{new Xml(${Value(string)}, $args.toList)} } } diff --git a/tests/run-macros/xml-interpolation-7/Macros_1.scala b/tests/run-macros/xml-interpolation-7/Macros_1.scala index d41af1bb8d2e..8cc1bca56b7c 100644 --- a/tests/run-macros/xml-interpolation-7/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-7/Macros_1.scala @@ -26,8 +26,8 @@ object XmlQuote { def impl(receiver: Expr[XMLOps.StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver match { - case '{ XMLOps.xml(${Expr(sc)}) } => sc.parts.mkString("??") + case '{ XMLOps.xml(${Value(sc)}) } => sc.parts.mkString("??") } - '{new Xml(${Expr(string)}, $args.toList)} + '{new Xml(${Value(string)}, $args.toList)} } } diff --git a/tests/run-staging/expr-matches.scala b/tests/run-staging/expr-matches.scala index cbfc6275108a..7efc9bc0ba77 100644 --- a/tests/run-staging/expr-matches.scala +++ b/tests/run-staging/expr-matches.scala @@ -7,7 +7,7 @@ object Test { def main(args: Array[String]): Unit = withQuotes { assert('{1} matches '{1}) assert('{println("foo")} matches '{println("foo")}) - assert('{println("foo")} matches '{println(${Expr("foo")})}) + assert('{println("foo")} matches '{println(${Value("foo")})}) assert('{println(Some("foo"))} matches '{println(${ val a = '{Some("foo")}; a})}) } } diff --git a/tests/run-staging/i3847-b.scala b/tests/run-staging/i3847-b.scala index c25b31e36866..63f87bbfa0a7 100644 --- a/tests/run-staging/i3847-b.scala +++ b/tests/run-staging/i3847-b.scala @@ -6,7 +6,7 @@ object Arrays { implicit def ArrayIsToExpr[T: ToExpr](implicit t: Type[T], qctx: Quotes): ToExpr[Array[List[T]]] = { new ToExpr[Array[List[T]]] { def apply(arr: Array[List[T]])(using Quotes) = '{ - new Array[List[T]](${Expr(arr.length)}) + new Array[List[T]](${Value(arr.length)}) // TODO add elements } } @@ -18,7 +18,7 @@ object Test { def main(args: Array[String]): Unit = withQuotes { import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} - val arr: Expr[Array[List[Int]]] = Expr(Array[List[Int]](List(1, 2, 3))) + val arr: Expr[Array[List[Int]]] = Value(Array[List[Int]](List(1, 2, 3))) println(arr.show) } } diff --git a/tests/run-staging/i3847.scala b/tests/run-staging/i3847.scala index 8d15d1d8d895..0c861477706e 100644 --- a/tests/run-staging/i3847.scala +++ b/tests/run-staging/i3847.scala @@ -6,7 +6,7 @@ object Arrays { implicit def ArrayIsToExpr[T: ToExpr](implicit t: Type[T], ct: Expr[ClassTag[T]]): ToExpr[Array[T]] = { new ToExpr[Array[T]] { def apply(arr: Array[T])(using Quotes) = '{ - new Array[t.Underlying](${Expr(arr.length)})($ct) + new Array[t.Underlying](${Value(arr.length)})($ct) // TODO add elements } } @@ -18,7 +18,7 @@ object Test { def main(args: Array[String]): Unit = withQuotes { import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} - val arr: Expr[Array[Int]] = Expr(Array[Int](1, 2, 3)) + val arr: Expr[Array[Int]] = Value(Array[Int](1, 2, 3)) println(arr.show) } } diff --git a/tests/run-staging/i3947.scala b/tests/run-staging/i3947.scala index 4e65cdcfe2ae..687dc48c5ae1 100644 --- a/tests/run-staging/i3947.scala +++ b/tests/run-staging/i3947.scala @@ -7,7 +7,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947b.scala b/tests/run-staging/i3947b.scala index 68dcd0ea85da..424dfcdcf9e8 100644 --- a/tests/run-staging/i3947b.scala +++ b/tests/run-staging/i3947b.scala @@ -8,7 +8,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println() println(name.show) diff --git a/tests/run-staging/i3947b2.scala b/tests/run-staging/i3947b2.scala index 375bdabe2a2c..6ed1434eb67b 100644 --- a/tests/run-staging/i3947b2.scala +++ b/tests/run-staging/i3947b2.scala @@ -8,7 +8,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: Quotes ?=> java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println() println(name.show) diff --git a/tests/run-staging/i3947b3.scala b/tests/run-staging/i3947b3.scala index 92a2e89e0628..546924c2c5d7 100644 --- a/tests/run-staging/i3947b3.scala +++ b/tests/run-staging/i3947b3.scala @@ -8,7 +8,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947c.scala b/tests/run-staging/i3947c.scala index f63890177c43..8bdfdb233d73 100644 --- a/tests/run-staging/i3947c.scala +++ b/tests/run-staging/i3947c.scala @@ -7,7 +7,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947d.scala b/tests/run-staging/i3947d.scala index 3b44a5126b3f..f11ebb17c992 100644 --- a/tests/run-staging/i3947d.scala +++ b/tests/run-staging/i3947d.scala @@ -6,7 +6,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947d2.scala b/tests/run-staging/i3947d2.scala index cc9e2a3839de..d360af3e9a62 100644 --- a/tests/run-staging/i3947d2.scala +++ b/tests/run-staging/i3947d2.scala @@ -7,7 +7,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947e.scala b/tests/run-staging/i3947e.scala index def71f6b51e9..1e670d79952c 100644 --- a/tests/run-staging/i3947e.scala +++ b/tests/run-staging/i3947e.scala @@ -8,7 +8,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947f.scala b/tests/run-staging/i3947f.scala index 048d6d296404..aa05758e0835 100644 --- a/tests/run-staging/i3947f.scala +++ b/tests/run-staging/i3947f.scala @@ -8,7 +8,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947g.scala b/tests/run-staging/i3947g.scala index 89d1d32c5c9a..4b5543cb33e8 100644 --- a/tests/run-staging/i3947g.scala +++ b/tests/run-staging/i3947g.scala @@ -6,7 +6,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947i.scala b/tests/run-staging/i3947i.scala index 698b91b8b21b..0b301c60b57e 100644 --- a/tests/run-staging/i3947i.scala +++ b/tests/run-staging/i3947i.scala @@ -7,7 +7,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i3947j.scala b/tests/run-staging/i3947j.scala index ea6dae78d9a3..fe20ae549dd3 100644 --- a/tests/run-staging/i3947j.scala +++ b/tests/run-staging/i3947j.scala @@ -7,7 +7,7 @@ object Test { def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { - val lclazz = Expr(clazz) + val lclazz = Value(clazz) val name = '{ ($lclazz).getCanonicalName } println(name.show) '{ println($name) } diff --git a/tests/run-staging/i4730.scala b/tests/run-staging/i4730.scala index 2b889270681b..197b0f1a8f3d 100644 --- a/tests/run-staging/i4730.scala +++ b/tests/run-staging/i4730.scala @@ -6,7 +6,7 @@ object Test { def ret(using Quotes): Expr[Int => Int] = '{ (x: Int) => ${ val z = run('{x + 1}) // throws scala.quoted.runtime.impl.ScopeException => - Expr(z) + Value(z) } } def main(args: Array[String]): Unit = { diff --git a/tests/run-staging/i5161.scala b/tests/run-staging/i5161.scala index e7ec50e72aed..6f2a80437d23 100644 --- a/tests/run-staging/i5161.scala +++ b/tests/run-staging/i5161.scala @@ -11,7 +11,7 @@ object Test { import Exp._ def evalTest(e: Exp)(using Quotes): Expr[Option[Int]] = e match { - case Int2(x) => '{ Some(${Expr(x)}) } + case Int2(x) => '{ Some(${Value(x)}) } case Add(e1, e2) => '{ (${evalTest(e1)}, ${evalTest(e2)}) match { diff --git a/tests/run-staging/i6992/Macro_1.scala b/tests/run-staging/i6992/Macro_1.scala index a7d766424695..d5581258fd02 100644 --- a/tests/run-staging/i6992/Macro_1.scala +++ b/tests/run-staging/i6992/Macro_1.scala @@ -22,7 +22,7 @@ package scala { import ctx.reflect._ try { body match { - case '{$x: Foo} => Expr(run(x).x) + case '{$x: Foo} => Value(run(x).x) } } catch { case ex: Exception if ex.getClass.getName == "scala.quoted.runtime.impl.ScopeException" => diff --git a/tests/run-staging/i7381.scala b/tests/run-staging/i7381.scala index 239158ca94b8..3d937547ff1b 100644 --- a/tests/run-staging/i7381.scala +++ b/tests/run-staging/i7381.scala @@ -6,7 +6,7 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) withQuotes { - val expr = Expr(List(1, 2, 3)) + val expr = Value(List(1, 2, 3)) println(expr.show) } } diff --git a/tests/run-staging/i8178.scala b/tests/run-staging/i8178.scala index 57001e9a7415..8d761006a9cc 100644 --- a/tests/run-staging/i8178.scala +++ b/tests/run-staging/i8178.scala @@ -3,13 +3,13 @@ import scala.quoted.staging._ def foo(n: Int, t: Expr[Int])(using Quotes): Expr[Int] = if (n == 0) t - else '{ val a = ${Expr(n)}; ${foo(n - 1, 'a)} + $t } + else '{ val a = ${Value(n)}; ${foo(n - 1, 'a)} + $t } @main def Test = { // make available the necessary toolbox for runtime code generation given Toolbox = Toolbox.make(getClass.getClassLoader) - val f: Int = run { foo(2, Expr(5)) } + val f: Int = run { foo(2, Value(5)) } println(f) } diff --git a/tests/run-staging/liftables.scala b/tests/run-staging/liftables.scala index df5c62d4ec25..fc1a9dcb6728 100644 --- a/tests/run-staging/liftables.scala +++ b/tests/run-staging/liftables.scala @@ -3,77 +3,77 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuotes { - println(Expr(true).show) - println(Expr(false).show) + println(Value(true).show) + println(Value(false).show) println() - println(Expr(3: Byte).show) - println(Expr(4: Short).show) - println(Expr(5: Int).show) - println(Expr(6: Long).show) - println(Expr(7.1: Float).show) - println(Expr(8.1: Double).show) + println(Value(3: Byte).show) + println(Value(4: Short).show) + println(Value(5: Int).show) + println(Value(6: Long).show) + println(Value(7.1: Float).show) + println(Value(8.1: Double).show) println() - println(Expr('a').show) - println(Expr("string").show) + println(Value('a').show) + println(Value("string").show) println() - println(Expr(classOf[String]).show) - println(Expr(summon[reflect.ClassTag[String]]).show) + println(Value(classOf[String]).show) + println(Value(summon[reflect.ClassTag[String]]).show) println() - println(Expr(Array("a")).show) - println(Expr(Array(true)).show) - println(Expr(Array(3: Byte)).show) - println(Expr(Array(4: Short)).show) - println(Expr(Array(5: Int)).show) - println(Expr(Array(6: Long)).show) - println(Expr(Array(7.1: Float)).show) - println(Expr(Array(8.1: Double)).show) + println(Value(Array("a")).show) + println(Value(Array(true)).show) + println(Value(Array(3: Byte)).show) + println(Value(Array(4: Short)).show) + println(Value(Array(5: Int)).show) + println(Value(Array(6: Long)).show) + println(Value(Array(7.1: Float)).show) + println(Value(Array(8.1: Double)).show) println() - println(Expr(IArray("b")).show) + println(Value(IArray("b")).show) println() - println(Expr(Seq(1, 2, 3)).show) - println(Expr(Nil).show) - println(Expr(List(1, 2, 3)).show) - println(Expr(Set(1, 2, 3)).show) - println(Expr(Map(1 -> 2, 2 -> 3)).show) + println(Value(Seq(1, 2, 3)).show) + println(Value(Nil).show) + println(Value(List(1, 2, 3)).show) + println(Value(Set(1, 2, 3)).show) + println(Value(Map(1 -> 2, 2 -> 3)).show) println() - println(Expr(None).show) - println(Expr(Some(4)).show) - println(Expr(Option(4)).show) + println(Value(None).show) + println(Value(Some(4)).show) + println(Value(Option(4)).show) println() - println(Expr(Left(1)).show) - println(Expr(Right(2)).show) - println(Expr(Right(3): Either[Int, Int]).show) + println(Value(Left(1)).show) + println(Value(Right(2)).show) + println(Value(Right(3): Either[Int, Int]).show) println() - println(Expr(BigInt("422")).show) - println(Expr(BigDecimal("422.54")).show) + println(Value(BigInt("422")).show) + println(Value(BigDecimal("422.54")).show) println() - println(Expr(StringContext("a", "b")).show) + println(Value(StringContext("a", "b")).show) println() - println(Expr(EmptyTuple).show) - println(Expr(1 *: EmptyTuple).show) - println(Expr((1, 2)).show) - println(Expr((1, 2, 3)).show) - println(Expr((1, 2, 3, 4)).show) - println(Expr((1, 2, 3, 4, 5)).show) - println(Expr((1, 2, 3, 4, 5, 6)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)).show) - println(Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25)).show) + println(Value(EmptyTuple).show) + println(Value(1 *: EmptyTuple).show) + println(Value((1, 2)).show) + println(Value((1, 2, 3)).show) + println(Value((1, 2, 3, 4)).show) + println(Value((1, 2, 3, 4, 5)).show) + println(Value((1, 2, 3, 4, 5, 6)).show) + println(Value((1, 2, 3, 4, 5, 6, 7)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)).show) + println(Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25)).show) } } diff --git a/tests/run-staging/multi-staging.check b/tests/run-staging/multi-staging.check index 5d12306ba4ef..9e8babd34c80 100644 --- a/tests/run-staging/multi-staging.check +++ b/tests/run-staging/multi-staging.check @@ -1,5 +1,5 @@ stage1 code: ((q1: scala.quoted.Quotes) ?=> { val x1: scala.Int = 2 - scala.quoted.runtime.Expr.quote[scala.Int](1.+(scala.quoted.runtime.Expr.nestedSplice[scala.Int](q1)(((evidence$5: scala.quoted.Quotes) ?=> scala.quoted.Expr.apply[scala.Int](x1)(scala.quoted.ToExpr.IntToExpr[scala.Int])(evidence$5))))).apply(using q1) + scala.quoted.runtime.Expr.quote[scala.Int](1.+(scala.quoted.runtime.Expr.nestedSplice[scala.Int](q1)(((evidence$5: scala.quoted.Quotes) ?=> scala.quoted.Value.apply[scala.Int](x1)(scala.quoted.ToExpr.IntToExpr[scala.Int])(evidence$5))))).apply(using q1) }) 3 diff --git a/tests/run-staging/multi-staging.scala b/tests/run-staging/multi-staging.scala index 57e916502022..822402263766 100644 --- a/tests/run-staging/multi-staging.scala +++ b/tests/run-staging/multi-staging.scala @@ -15,7 +15,7 @@ object Test { def stage1(x: Expr[Int])(using Quotes): Expr[Quotes ?=> Expr[Int]] = val code = '{ (using q1: Quotes) => val x1 = $x - '{ 1 + ${Expr(x1)} } + '{ 1 + ${Value(x1)} } } println("stage1 code: " + code.show) code diff --git a/tests/run-staging/quote-lib.scala b/tests/run-staging/quote-lib.scala index 042fa58c17c7..6491ec2bad5d 100644 --- a/tests/run-staging/quote-lib.scala +++ b/tests/run-staging/quote-lib.scala @@ -20,44 +20,44 @@ object Test { liftedWhile('{true})('{ println(1) }).show liftedDoWhile('{ println(1) })('{true}).show - val t1: Expr[Tuple1[Int]] = Expr(Tuple1(4)) - val t2: Expr[(Int, Int)] = Expr((2, 3)) - val t3: Expr[(Int, Int, Int)] = Expr((2, 3, 4)) - val t4: Expr[(Int, Int, Int, Int)] = Expr((2, 3, 4, 5)) - Expr((1, 2, 3, 4)) - Expr((1, 2, 3, 4, 5)) - Expr((1, 2, 3, 4, 5, 6)) - Expr((1, 2, 3, 4, 5, 6, 7)) - Expr((1, 2, 3, 4, 5, 6, 7, 8)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)) - Expr((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25)) + val t1: Expr[Tuple1[Int]] = Value(Tuple1(4)) + val t2: Expr[(Int, Int)] = Value((2, 3)) + val t3: Expr[(Int, Int, Int)] = Value((2, 3, 4)) + val t4: Expr[(Int, Int, Int, Int)] = Value((2, 3, 4, 5)) + Value((1, 2, 3, 4)) + Value((1, 2, 3, 4, 5)) + Value((1, 2, 3, 4, 5, 6)) + Value((1, 2, 3, 4, 5, 6, 7)) + Value((1, 2, 3, 4, 5, 6, 7, 8)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24)) + Value((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25)) val list: List[Int] = List(1, 2, 3) - val liftedList: Expr[List[Int]] = Expr(list) + val liftedList: Expr[List[Int]] = Value(list) val seq: Seq[Int] = Seq(1, 2, 3) - val liftedSeq: Expr[Seq[Int]] = Expr(seq) + val liftedSeq: Expr[Seq[Int]] = Value(seq) val set: Set[Int] = Set(1, 2, 3) - val liftedSet: Expr[Set[Int]] = Expr(set) + val liftedSet: Expr[Set[Int]] = Value(set) val map: Map[Int, Char] = Map(1 -> 'a', 2 -> 'b', 3 -> 'c') - val liftedMap: Expr[Map[Int, Char]] = Expr(map) + val liftedMap: Expr[Map[Int, Char]] = Value(map) liftedList.foldLeft[Int]('{0})('{ (acc: Int, x: Int) => acc + x }).show liftedList.foreach('{ (x: Int) => println(x) }).show @@ -66,43 +66,43 @@ object Test { list.unrolledForeach('{ (x: Int) => println(x) }).show val iarray: IArray[Int] = IArray(1, 2, 3) - val liftedIArray: Expr[IArray[Int]] = Expr(iarray) + val liftedIArray: Expr[IArray[Int]] = Value(iarray) val iarray2: IArray[String] = IArray("a", "b", "c") - Expr(iarray2) - - Expr(IArray(false)) - Expr(IArray(1: Byte)) - Expr(IArray(1: Short)) - Expr(IArray(1)) - Expr(IArray(1L)) - Expr(IArray(1.1f)) - Expr(IArray(1.1d)) - Expr(IArray('a')) - Expr(IArray((1, 3))) + Value(iarray2) + + Value(IArray(false)) + Value(IArray(1: Byte)) + Value(IArray(1: Short)) + Value(IArray(1)) + Value(IArray(1L)) + Value(IArray(1.1f)) + Value(IArray(1.1d)) + Value(IArray('a')) + Value(IArray((1, 3))) val array: Array[Int] = Array(1, 2, 3) - val liftedArray: Expr[Array[Int]] = Expr(array) - - Expr(Array(false)) - Expr(Array(1: Byte)) - Expr(Array(1: Short)) - Expr(Array(1)) - Expr(Array(1L)) - Expr(Array(1.1f)) - Expr(Array(1.1d)) - Expr(Array('a')) - Expr(Array((1, 3))) + val liftedArray: Expr[Array[Int]] = Value(array) + + Value(Array(false)) + Value(Array(1: Byte)) + Value(Array(1: Short)) + Value(Array(1)) + Value(Array(1L)) + Value(Array(1.1f)) + Value(Array(1.1d)) + Value(Array('a')) + Value(Array((1, 3))) val some: Option[Int] = Some(2) val none: Option[Int] = Some(2) - val liftedSome: Expr[Option[Int]] = Expr(some) - val liftedNone: Expr[Option[Int]] = Expr(none) + val liftedSome: Expr[Option[Int]] = Value(some) + val liftedNone: Expr[Option[Int]] = Value(none) val left: Either[Int, Long] = Left(1) val right: Either[Int, Long] = Right(2L) - Expr(left) - Expr(right) + Value(left) + Value(right) println("quote lib ok") } @@ -152,11 +152,11 @@ package liftable { implicit class UnrolledOps[T: ToExpr](list: List[T])(implicit t: Type[T], qctx: Quotes) { def unrolledFoldLeft[U](acc: Expr[U])(f: Expr[(U, T) => U])(implicit u: Type[U]): Expr[U] = list match { - case x :: xs => xs.unrolledFoldLeft('{ ($f).apply($acc, ${Expr(x)}) })(f) + case x :: xs => xs.unrolledFoldLeft('{ ($f).apply($acc, ${Value(x)}) })(f) case Nil => acc } def unrolledForeach(f: Expr[T => Unit]): Expr[Unit] = list match { - case x :: xs => '{ ($f).apply(${Expr(x)}); ${ xs.unrolledForeach(f) } } + case x :: xs => '{ ($f).apply(${Value(x)}); ${ xs.unrolledForeach(f) } } case Nil => '{} } } diff --git a/tests/run-staging/quote-lift-Array.scala b/tests/run-staging/quote-lift-Array.scala index 6e61e67ce6d0..8c64f7f7001f 100644 --- a/tests/run-staging/quote-lift-Array.scala +++ b/tests/run-staging/quote-lift-Array.scala @@ -7,25 +7,25 @@ object Test { def p[T](arr: Array[T]): Unit = { println(arr.asInstanceOf[Array[_]].mkString("[", ", ", "]")) } - p(${Expr(Array.empty[Boolean])}) - p(${Expr(Array.empty[Byte])}) - p(${Expr(Array.empty[Short])}) - p(${Expr(Array.empty[Char])}) - p(${Expr(Array.empty[Int])}) - p(${Expr(Array.empty[Long])}) - p(${Expr(Array.empty[Float])}) - p(${Expr(Array.empty[Double])}) - p(${Expr(Array.empty[String])}) + p(${Value(Array.empty[Boolean])}) + p(${Value(Array.empty[Byte])}) + p(${Value(Array.empty[Short])}) + p(${Value(Array.empty[Char])}) + p(${Value(Array.empty[Int])}) + p(${Value(Array.empty[Long])}) + p(${Value(Array.empty[Float])}) + p(${Value(Array.empty[Double])}) + p(${Value(Array.empty[String])}) println() - p(${Expr(Array(true))}) - p(${Expr(Array[Byte](1, 2))}) - p(${Expr(Array[Short](2, 3))}) - p(${Expr(Array[Char]('a', 'b'))}) - p(${Expr(Array[Int](4, 5))}) - p(${Expr(Array[Long](6L, 7L))}) - p(${Expr(Array[Float](2.1f, 3.2f))}) - p(${Expr(Array[Double](2.2, 3.3))}) - p(${Expr(Array("abc", "xyz"))}) + p(${Value(Array(true))}) + p(${Value(Array[Byte](1, 2))}) + p(${Value(Array[Short](2, 3))}) + p(${Value(Array[Char]('a', 'b'))}) + p(${Value(Array[Int](4, 5))}) + p(${Value(Array[Long](6L, 7L))}) + p(${Value(Array[Float](2.1f, 3.2f))}) + p(${Value(Array[Double](2.2, 3.3))}) + p(${Value(Array("abc", "xyz"))}) } } } \ No newline at end of file diff --git a/tests/run-staging/quote-lift-BigDecimal.scala b/tests/run-staging/quote-lift-BigDecimal.scala index 7f94418535ec..74ec01b35e75 100644 --- a/tests/run-staging/quote-lift-BigDecimal.scala +++ b/tests/run-staging/quote-lift-BigDecimal.scala @@ -3,8 +3,8 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = println(run { - val a = Expr(BigDecimal(2.3)) - val b = Expr(BigDecimal("1005849025843905834908593485984390583429058574925.95489543")) + val a = Value(BigDecimal(2.3)) + val b = Value(BigDecimal("1005849025843905834908593485984390583429058574925.95489543")) '{ ($a, $b) } }) } diff --git a/tests/run-staging/quote-lift-BigInt.scala b/tests/run-staging/quote-lift-BigInt.scala index cb35d779cd97..35c980994a01 100644 --- a/tests/run-staging/quote-lift-BigInt.scala +++ b/tests/run-staging/quote-lift-BigInt.scala @@ -3,8 +3,8 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = println(run { - val a = Expr(BigInt(2)) - val b = Expr(BigInt("1005849025843905834908593485984390583429058574925")) + val a = Value(BigInt(2)) + val b = Value(BigInt("1005849025843905834908593485984390583429058574925")) '{ ($a, $b) } }) } diff --git a/tests/run-staging/quote-lift-IArray.scala b/tests/run-staging/quote-lift-IArray.scala index 28a8d96fc876..20dbcb6ef98a 100644 --- a/tests/run-staging/quote-lift-IArray.scala +++ b/tests/run-staging/quote-lift-IArray.scala @@ -8,25 +8,25 @@ object Test { def p[T](arr: IArray[T]): Unit = { println(arr.asInstanceOf[Array[_]].mkString("[", ", ", "]")) } - p(${Expr(IArray.empty[Boolean])}) - p(${Expr(IArray.empty[Byte])}) - p(${Expr(IArray.empty[Short])}) - p(${Expr(IArray.empty[Char])}) - p(${Expr(IArray.empty[Int])}) - p(${Expr(IArray.empty[Long])}) - p(${Expr(IArray.empty[Float])}) - p(${Expr(IArray.empty[Double])}) - p(${Expr(IArray.empty[String])}) + p(${Value(IArray.empty[Boolean])}) + p(${Value(IArray.empty[Byte])}) + p(${Value(IArray.empty[Short])}) + p(${Value(IArray.empty[Char])}) + p(${Value(IArray.empty[Int])}) + p(${Value(IArray.empty[Long])}) + p(${Value(IArray.empty[Float])}) + p(${Value(IArray.empty[Double])}) + p(${Value(IArray.empty[String])}) println() - p(${Expr(IArray(true))}) - p(${Expr(IArray[Byte](1, 2))}) - p(${Expr(IArray[Short](2, 3))}) - p(${Expr(IArray[Char]('a', 'b'))}) - p(${Expr(IArray[Int](4, 5))}) - p(${Expr(IArray[Long](6L, 7L))}) - p(${Expr(IArray[Float](2.1f, 3.2f))}) - p(${Expr(IArray[Double](2.2, 3.3))}) - p(${Expr(IArray("abc", "xyz"))}) + p(${Value(IArray(true))}) + p(${Value(IArray[Byte](1, 2))}) + p(${Value(IArray[Short](2, 3))}) + p(${Value(IArray[Char]('a', 'b'))}) + p(${Value(IArray[Int](4, 5))}) + p(${Value(IArray[Long](6L, 7L))}) + p(${Value(IArray[Float](2.1f, 3.2f))}) + p(${Value(IArray[Double](2.2, 3.3))}) + p(${Value(IArray("abc", "xyz"))}) } } } \ No newline at end of file diff --git a/tests/run-staging/quote-run-constants.scala b/tests/run-staging/quote-run-constants.scala index 4e30760cd683..b64a3346423a 100644 --- a/tests/run-staging/quote-run-constants.scala +++ b/tests/run-staging/quote-run-constants.scala @@ -8,38 +8,38 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def runAndPrint[T](expr: Quotes ?=> Expr[T]): Unit = println(run(expr)) - runAndPrint(Expr(true)) - runAndPrint(Expr('a')) - runAndPrint(Expr('\n')) - runAndPrint(Expr('"')) - runAndPrint(Expr('\'')) - runAndPrint(Expr('\\')) - runAndPrint(Expr(1)) - runAndPrint(Expr(2)) - runAndPrint(Expr(3L)) - runAndPrint(Expr(4.0f)) - runAndPrint(Expr(5.0d)) - runAndPrint(Expr("xyz")) + runAndPrint(Value(true)) + runAndPrint(Value('a')) + runAndPrint(Value('\n')) + runAndPrint(Value('"')) + runAndPrint(Value('\'')) + runAndPrint(Value('\\')) + runAndPrint(Value(1)) + runAndPrint(Value(2)) + runAndPrint(Value(3L)) + runAndPrint(Value(4.0f)) + runAndPrint(Value(5.0d)) + runAndPrint(Value("xyz")) println("======") withQuotes { def show[T](expr: Expr[T]): Unit = println(expr.show) - show(Expr(true)) - show(Expr('a')) - show(Expr('\n')) - show(Expr('"')) - show(Expr('\'')) - show(Expr('\\')) - show(Expr(1)) - show(Expr(2)) - show(Expr(3L)) - show(Expr(4.0f)) - show(Expr(5.0d)) - show(Expr("xyz")) - show(Expr("\n\\\"'")) - show(Expr( + show(Value(true)) + show(Value('a')) + show(Value('\n')) + show(Value('"')) + show(Value('\'')) + show(Value('\\')) + show(Value(1)) + show(Value(2)) + show(Value(3L)) + show(Value(4.0f)) + show(Value(5.0d)) + show(Value("xyz")) + show(Value("\n\\\"'")) + show(Value( """abc xyz""")) } diff --git a/tests/run-staging/quote-run-many.scala b/tests/run-staging/quote-run-many.scala index 68305fbb42a7..b9a035727d8b 100644 --- a/tests/run-staging/quote-run-many.scala +++ b/tests/run-staging/quote-run-many.scala @@ -5,7 +5,7 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) def expr(i: Int)(using Quotes) = '{ - val a = 3 + ${Expr(i)} + val a = 3 + ${Value(i)} 2 + a } for (i <- 0 to 50) diff --git a/tests/run-staging/quote-run-staged-interpreter.scala b/tests/run-staging/quote-run-staged-interpreter.scala index ea45cb8ae3c8..006156b018e0 100644 --- a/tests/run-staging/quote-run-staged-interpreter.scala +++ b/tests/run-staging/quote-run-staged-interpreter.scala @@ -13,7 +13,7 @@ object Test { def compile(e: Exp, env: Map[String, Expr[Int]], keepLets: Boolean)(using Quotes): Expr[Int] = { def compileImpl(e: Exp, env: Map[String, Expr[Int]]): Expr[Int] = e match { - case Num(n) => Expr(n) + case Num(n) => Value(n) case Plus(e1, e2) => '{${compileImpl(e1, env)} + ${compileImpl(e2, env)}} case Var(x) => env(x) case Let(x, e, body) => diff --git a/tests/run-staging/quote-show-blocks.scala b/tests/run-staging/quote-show-blocks.scala index 740db59a1030..27dad50b77ef 100644 --- a/tests/run-staging/quote-show-blocks.scala +++ b/tests/run-staging/quote-show-blocks.scala @@ -6,14 +6,14 @@ object Test { def main(args: Array[String]): Unit = run { def a(n: Int, x: Expr[Unit]): Expr[Unit] = if (n == 0) x - else a(n - 1, '{ println(${Expr(n)}); $x }) + else a(n - 1, '{ println(${Value(n)}); $x }) println(a(5, '{}).show) def b(n: Int, x: Expr[Unit]): Expr[Unit] = if (n == 0) x - else b(n - 1, '{ $x; println(${Expr(n)}) }) + else b(n - 1, '{ $x; println(${Value(n)}) }) println(b(5, '{}).show) '{} diff --git a/tests/run-staging/quote-unrolled-foreach.scala b/tests/run-staging/quote-unrolled-foreach.scala index 0c66ba34fa3c..37c293f5b929 100644 --- a/tests/run-staging/quote-unrolled-foreach.scala +++ b/tests/run-staging/quote-unrolled-foreach.scala @@ -29,13 +29,13 @@ object Test { println(code4.show) println() - def liftedArray(using Quotes): Expr[Array[Int]] = Expr(Array(1, 2, 3, 4)) + def liftedArray(using Quotes): Expr[Array[Int]] = Value(Array(1, 2, 3, 4)) println(liftedArray.show) println() def printAll(arr: Array[Int]) = '{ - val arr1 = ${ Expr(arr) } + val arr1 = ${ Value(arr) } ${ foreach1('arr1, '{x => println(x)}) } } @@ -110,17 +110,17 @@ object Test { def foreach4(arrRef: Expr[Array[Int]], f: Expr[Int => Unit], unrollSize: Int)(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 - if (size % ${Expr(unrollSize)} != 0) throw new Exception("...") // for simplicity of the implementation + if (size % ${Value(unrollSize)} != 0) throw new Exception("...") // for simplicity of the implementation while (i < size) { - ${ foreachInRange(0, unrollSize)(j => '{ ($f)(($arrRef)(i + ${Expr(j)})) }) } - i += ${Expr(unrollSize)} + ${ foreachInRange(0, unrollSize)(j => '{ ($f)(($arrRef)(i + ${Value(j)})) }) } + i += ${Value(unrollSize)} } } implicit object ArrayIntIsToExpr extends ToExpr[Array[Int]] { override def apply(x: Array[Int])(using Quotes) = '{ - val array = new Array[Int](${Expr(x.length)}) - ${ foreachInRange(0, x.length)(i => '{ array(${Expr(i)}) = ${Expr(x(i))}}) } + val array = new Array[Int](${Value(x.length)}) + ${ foreachInRange(0, x.length)(i => '{ array(${Value(i)}) = ${Value(x(i))}}) } array } } diff --git a/tests/run-staging/shonan-hmm-simple.scala b/tests/run-staging/shonan-hmm-simple.scala index 31cb274b34f2..31f432cef3e3 100644 --- a/tests/run-staging/shonan-hmm-simple.scala +++ b/tests/run-staging/shonan-hmm-simple.scala @@ -35,7 +35,7 @@ sealed trait PV[T]: def expr(using ToExpr[T], Quotes): Expr[T] case class Sta[T](x: T) extends PV[T]: - def expr(using ToExpr[T], Quotes): Expr[T] = Expr(x) + def expr(using ToExpr[T], Quotes): Expr[T] = Value(x) case class Dyn[T](x: Expr[T]) extends PV[T]: def expr(using ToExpr[T], Quotes): Expr[T] = x @@ -64,7 +64,7 @@ case class Complex[T](re: T, im: T) object Complex: implicit def isToExpr[T: Type: ToExpr]: ToExpr[Complex[T]] = new ToExpr[Complex[T]]: - def apply(comp: Complex[T])(using Quotes) = '{Complex(${Expr(comp.re)}, ${Expr(comp.im)})} + def apply(comp: Complex[T])(using Quotes) = '{Complex(${Value(comp.re)}, ${Value(comp.im)})} case class Vec[Idx, T](size: Idx, get: Idx => T): def map[U](f: T => U): Vec[Idx, U] = Vec(size, i => f(get(i))) @@ -125,8 +125,8 @@ object Test: def blasStaticIntExpr(using Quotes) = new Blas1(new RingIntExpr, new StaticVecOps) def resCode1(using Quotes) = blasStaticIntExpr.dot( - vec1.map(Expr(_)), - vec2.map(Expr(_)) + vec1.map(Value(_)), + vec2.map(Value(_)) ) println(withQuotes(resCode1.show)) println(run(resCode1)) @@ -149,7 +149,7 @@ object Test: def blasStaticIntPVExpr(using Quotes) = new Blas1(new RingPV[Int](new RingInt, new RingIntExpr), new StaticVecOps) def resCode3(using Quotes) = blasStaticIntPVExpr.dot( - vec1.map(i => Dyn(Expr(i))), + vec1.map(i => Dyn(Value(i))), vec2.map(i => Sta(i)) ).expr println(withQuotes(resCode3.show)) @@ -159,10 +159,10 @@ object Test: def blasExprIntPVExpr(using Quotes) = new Blas1(new RingPV[Int](new RingInt, new RingIntExpr), new StaticVecOps) def resCode4(using Quotes): Expr[Array[Int] => Int] = '{ arr => - if (arr.length != ${Expr(vec2.size)}) throw new Exception("...") + if (arr.length != ${Value(vec2.size)}) throw new Exception("...") ${ blasExprIntPVExpr.dot( - new Vec(vec2.size, i => Dyn('{arr(${Expr(i)})})), + new Vec(vec2.size, i => Dyn('{arr(${Value(i)})})), vec2.map(i => Sta(i)) ).expr } @@ -176,10 +176,10 @@ object Test: def blasExprComplexPVInt(using Quotes) = new Blas1[Int, Complex[PV[Int]]](new RingComplex(new RingPV[Int](new RingInt, new RingIntExpr)), new StaticVecOps) def resCode5(using Quotes): Expr[Array[Complex[Int]] => Complex[Int]] = '{ arr => - if (arr.length != ${Expr(cmpxVec2.size)}) throw new Exception("...") + if (arr.length != ${Value(cmpxVec2.size)}) throw new Exception("...") ${ val cpx = blasExprComplexPVInt.dot( - new Vec(cmpxVec2.size, i => Complex(Dyn('{arr(${Expr(i)}).re}), Dyn('{arr(${Expr(i)}).im}))), + new Vec(cmpxVec2.size, i => Complex(Dyn('{arr(${Value(i)}).re}), Dyn('{arr(${Value(i)}).im}))), new Vec(cmpxVec2.size, i => Complex(Sta(cmpxVec2.get(i).re), Sta(cmpxVec2.get(i).im))) ) '{Complex(${cpx.re.expr}, ${cpx.im.expr})} @@ -194,7 +194,7 @@ object Test: def dotIntOptExpr(using Quotes) = new Blas1(RingPVInt, new StaticVecOps).dot // will generate the code '{ ((arr: scala.Array[scala.Int]) => arr.apply(1).+(arr.apply(3))) } def staticVec(using Quotes) = Vec[Int, PV[Int]](5, i => Sta((i % 2))) - def code(using Quotes) = '{(arr: Array[Int]) => ${dotIntOptExpr(Vec(5, i => Dyn('{arr(${Expr(i)})})), staticVec).expr} } + def code(using Quotes) = '{(arr: Array[Int]) => ${dotIntOptExpr(Vec(5, i => Dyn('{arr(${Value(i)})})), staticVec).expr} } println(withQuotes(code.show)) println() diff --git a/tests/run-staging/shonan-hmm/Complex.scala b/tests/run-staging/shonan-hmm/Complex.scala index cf71da66da1b..450ee618f3f5 100644 --- a/tests/run-staging/shonan-hmm/Complex.scala +++ b/tests/run-staging/shonan-hmm/Complex.scala @@ -5,7 +5,7 @@ case class Complex[T](re: T, im: T) object Complex { implicit def complexIsToExpr[T: Type: ToExpr]: ToExpr[Complex[T]] = new ToExpr { - def apply(c: Complex[T])(using Quotes) = '{ Complex(${Expr(c.re)}, ${Expr(c.im)}) } + def apply(c: Complex[T])(using Quotes) = '{ Complex(${Value(c.re)}, ${Value(c.im)}) } } def of_complex_expr(x: Expr[Complex[Int]])(using Quotes): Complex[Expr[Int]] = Complex('{$x.re}, '{$x.im}) diff --git a/tests/run-staging/shonan-hmm/Lifters.scala b/tests/run-staging/shonan-hmm/Lifters.scala index bfe71c6cd750..8f602fe3b746 100644 --- a/tests/run-staging/shonan-hmm/Lifters.scala +++ b/tests/run-staging/shonan-hmm/Lifters.scala @@ -6,19 +6,19 @@ import scala.quoted._ object Lifters { implicit def LiftedClassTag[T: Type: ClassTag] (using Quotes): Expr[ClassTag[T]] = { - '{ ClassTag(${Expr(summon[ClassTag[T]].runtimeClass.asInstanceOf[Class[T]])}) } + '{ ClassTag(${Value(summon[ClassTag[T]].runtimeClass.asInstanceOf[Class[T]])}) } } implicit def ArrayIsToExpr[T : Type: ClassTag](implicit l: ToExpr[T]): ToExpr[Array[T]] = new ToExpr[Array[T]] { def apply(x: Array[T])(using Quotes) = '{ - val array = new Array[T](${Expr(x.length)})(${implicitly[Expr[ClassTag[T]]]}) + val array = new Array[T](${Value(x.length)})(${implicitly[Expr[ClassTag[T]]]}) ${initArray(x, 'array)} } } implicit def IntArrayIsToExpr: ToExpr[Array[Int]] = new ToExpr[Array[Int]] { def apply(x: Array[Int])(using Quotes) = '{ - val array = new Array[Int](${Expr(x.length)}) + val array = new Array[Int](${Value(x.length)}) ${initArray(x, 'array)} } } @@ -26,7 +26,7 @@ object Lifters { private def initArray[T : ToExpr : Type](arr: Array[T], array: Expr[Array[T]])(using Quotes): Expr[Array[T]] = { UnrolledExpr.block( arr.zipWithIndex.map { - case (x, i) => '{ $array(${Expr(i)}) = ${Expr(x)} } + case (x, i) => '{ $array(${Value(i)}) = ${Value(x)} } }.toList, array) } diff --git a/tests/run-staging/shonan-hmm/MVmult.scala b/tests/run-staging/shonan-hmm/MVmult.scala index 5a26c7c629b4..48329353b2a8 100644 --- a/tests/run-staging/shonan-hmm/MVmult.scala +++ b/tests/run-staging/shonan-hmm/MVmult.scala @@ -40,12 +40,12 @@ object MVmult { val MV = new MVmult[Int, Expr[Int], Expr[Unit]](new RingIntExpr, new VecRStaDim(new RingIntExpr)) '{ (vout, a, v) => { - if (${Expr(n)} != vout.length) throw new IndexOutOfBoundsException(${Expr(n.toString)}) - if (${Expr(m)} != v.length) throw new IndexOutOfBoundsException(${Expr(m.toString)}) + if (${Value(n)} != vout.length) throw new IndexOutOfBoundsException(${Value(n.toString)}) + if (${Value(m)} != v.length) throw new IndexOutOfBoundsException(${Value(m.toString)}) ${ - val vout_ = OVec(n, (i, x: Expr[Int]) => '{vout(${Expr(i)}) = $x}) - val a_ = Vec(n, i => Vec(m, j => '{ a(${Expr(i)})(${Expr(j)}) } )) - val v_ = Vec(m, i => '{v(${Expr(i)})}) + val vout_ = OVec(n, (i, x: Expr[Int]) => '{vout(${Value(i)}) = $x}) + val a_ = Vec(n, i => Vec(m, j => '{ a(${Value(i)})(${Value(j)}) } )) + val v_ = Vec(m, i => '{v(${Value(i)})}) MV.mvmult(vout_, a_, v_) } @@ -56,7 +56,7 @@ object MVmult { def mvmult_ac(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { import Lifters._ '{ - val arr = ${Expr(a)} + val arr = ${Value(a)} ${ val (n, m, a2) = amat1(a, 'arr) mvmult_abs0(new RingIntPExpr, new VecRStaDyn(new RingIntPExpr))(n, m, a2) @@ -67,7 +67,7 @@ object MVmult { def mvmult_opt(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { import Lifters._ '{ - val arr = ${Expr(a)} + val arr = ${Value(a)} ${ val (n, m, a2) = amat1(a, 'arr) mvmult_abs0(new RingIntOPExpr, new VecRStaDyn(new RingIntPExpr))(n, m, a2) @@ -78,7 +78,7 @@ object MVmult { def mvmult_roll(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { import Lifters._ '{ - val arr = ${Expr(a)} + val arr = ${Value(a)} ${ val (n, m, a2) = amat1(a, 'arr) mvmult_abs0(new RingIntOPExpr, new VecRStaOptDynInt(new RingIntPExpr))(n, m, a2) @@ -106,7 +106,7 @@ object MVmult { val default: Expr[Array[Int]] = '{null.asInstanceOf[Array[Int]]} // never accessed loop(i + 1, default :: acc) } else '{ - val row = ${Expr(a(i))} + val row = ${Value(a(i))} ${ loop(i + 1, 'row :: acc) } } } @@ -118,7 +118,7 @@ object MVmult { val m = a(0).length val vec: Vec[PV[Int], Vec[PV[Int], PV[Int]]] = Vec(Sta(n), i => Vec(Sta(m), j => (i, j) match { case (Sta(i), Sta(j)) => Sta(a(i)(j)) - case (Sta(i), Dyn(j)) => Dyn('{$aa(${Expr(i)})($j)}) + case (Sta(i), Dyn(j)) => Dyn('{$aa(${Value(i)})($j)}) case (i, j) => Dyn('{ $aa(${Dyns.dyni(i)})(${Dyns.dyni(j)}) }) })) (n, m, vec) @@ -149,7 +149,7 @@ object MVmult { def copy_row1(using Quotes): Array[Int] => (Expr[Int] => Expr[Int]) = v => { import Lifters._ - val arr = Expr(v) + val arr = Value(v) i => '{ ($arr).apply($i) } } @@ -162,8 +162,8 @@ object MVmult { private def mvmult_abs0(ring: Ring[PV[Int]], vecOp: VecROp[PV[Int], PV[Int], Expr[Unit]])(n: Int, m: Int, a: Vec[PV[Int], Vec[PV[Int], PV[Int]]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { '{ (vout, v) => { - if (${Expr(n)} != vout.length) throw new IndexOutOfBoundsException(${Expr(n.toString)}) - if (${Expr(m)} != v.length) throw new IndexOutOfBoundsException(${Expr(m.toString)}) + if (${Value(n)} != vout.length) throw new IndexOutOfBoundsException(${Value(n.toString)}) + if (${Value(m)} != v.length) throw new IndexOutOfBoundsException(${Value(m.toString)}) ${ val vout_ : OVec[PV[Int], PV[Int], Expr[Unit]] = OVec(Sta(n), (i, x) => '{vout(${Dyns.dyni(i)}) = ${Dyns.dyn(x)}}) val v_ : Vec[PV[Int], PV[Int]] = Vec(Sta(m), i => Dyn('{v(${Dyns.dyni(i)})})) diff --git a/tests/run-staging/shonan-hmm/PV.scala b/tests/run-staging/shonan-hmm/PV.scala index 46e56b7d4ab7..cfc698f1fc3b 100644 --- a/tests/run-staging/shonan-hmm/PV.scala +++ b/tests/run-staging/shonan-hmm/PV.scala @@ -8,11 +8,11 @@ case class Sta[T](x: T) extends PV[T] case class Dyn[T](x: Expr[T]) extends PV[T] object Dyn: - def apply[T: ToExpr](x: T)(using Quotes): Dyn[T] = Dyn(Expr(x)) + def apply[T: ToExpr](x: T)(using Quotes): Dyn[T] = Dyn(Value(x)) object Dyns { def dyn[T: ToExpr](pv: PV[T])(using Quotes): Expr[T] = pv match { - case Sta(x) => Expr(x) + case Sta(x) => Value(x) case Dyn(x) => x } def dyni(using Quotes): PV[Int] => Expr[Int] = dyn[Int] diff --git a/tests/run-staging/staged-tuples/StagedTuple.scala b/tests/run-staging/staged-tuples/StagedTuple.scala index 74933f6ace69..19b2d6bef2a3 100644 --- a/tests/run-staging/staged-tuples/StagedTuple.scala +++ b/tests/run-staging/staged-tuples/StagedTuple.scala @@ -73,7 +73,7 @@ object StagedTuple { val res = if (!specialize) '{scala.runtime.Tuple.size($tup)} else size match { - case Some(n) => Expr(n) + case Some(n) => Value(n) case None => '{scala.runtime.Tuple.size($tup)} } res.as[Res] @@ -133,7 +133,7 @@ object StagedTuple { def fallbackApply(): Expr[Elem[Tup, N]] = nValue match { case Some(n) => quotes.reflect.report.error("index out of bounds: " + n, tup) - '{ throw new IndexOutOfBoundsException(${Expr(n.toString)}) } + '{ throw new IndexOutOfBoundsException(${Value(n.toString)}) } case None => '{scala.runtime.Tuple.apply($tup, $n)}.as[Elem[Tup, N]] } val res = size match { @@ -170,13 +170,13 @@ object StagedTuple { case Some(s) if s > 4 && s <= MaxSpecialized => val t = tup.as[Product] nValue match { - case Some(n) if n >= 0 && n < s => '{$t.productElement(${ Expr(n) })} + case Some(n) if n >= 0 && n < s => '{$t.productElement(${ Value(n) })} case _ => fallbackApply() } case Some(s) if s > MaxSpecialized => val t = tup.as[TupleXXL] nValue match { - case Some(n) if n >= 0 && n < s => '{$t.elems(${ Expr(n) })} + case Some(n) if n >= 0 && n < s => '{$t.elems(${ Value(n) })} case _ => fallbackApply() } case _ => fallbackApply() diff --git a/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala b/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala index 8ac1aacb46f1..c5a711f3570a 100644 --- a/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala +++ b/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala @@ -13,8 +13,8 @@ object Macros { // n is a lifted constant val n = 2 - val show2 = withQuotes(power(Expr(n), '{4.0}).show) - val run2 = run(power(Expr(n), '{4.0})) + val show2 = withQuotes(power(Value(n), '{4.0}).show) + val run2 = run(power(Value(n), '{4.0})) // n is a constant in a quote val show3 = withQuotes(power('{2}, '{5.0}).show) @@ -26,17 +26,17 @@ object Macros { val run4 = run(power(n2, '{6.0})) '{ - println(${Expr(show1)}) - println(${Expr(run1)}) + println(${Value(show1)}) + println(${Value(run1)}) println() - println(${Expr(show2)}) - println(${Expr(run2)}) + println(${Value(show2)}) + println(${Value(run2)}) println() - println(${Expr(show3)}) - println(${Expr(run3)}) + println(${Value(show3)}) + println(${Value(run3)}) println() - println(${Expr(show4)}) - println(${Expr(run4)}) + println(${Value(show4)}) + println(${Value(run4)}) } }