Skip to content

Commit ff100f4

Browse files
Merge pull request #8525 from dotty-staging/remove-all-quoted-deprecated-api-uses
Remove all quoted deprecated API uses
2 parents ea27651 + 6c2b280 commit ff100f4

File tree

41 files changed

+120
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+120
-121
lines changed

library/src/scala/quoted/Expr.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ class Expr[+T] private[scala] {
3434
* Emits an error error and throws if the expression does not contain a value or contains side effects.
3535
* Otherwise returns the value.
3636
*/
37-
@deprecated("Use Expr.unlifted", "0.23")
38-
final def value[U >: T](using qctx: QuoteContext, unlift: Unliftable[U]): U = unlifted
37+
@deprecated("Use Expr.unliftOrError", "0.23")
38+
final def value[U >: T](using qctx: QuoteContext, unlift: Unliftable[U]): U = unliftOrError
3939

4040
/** Return the unlifted value of this expression.
4141
*
42-
* Emits an error error and throws if the expression does not contain a value or contains side effects.
42+
* Emits an error and throws if the expression does not contain a value or contains side effects.
4343
* Otherwise returns the value.
4444
*/
45-
final def unlifted[U >: T](using qctx: QuoteContext, unlift: Unliftable[U]): U =
45+
final def unliftOrError[U >: T](using qctx: QuoteContext, unlift: Unliftable[U]): U =
4646
unlift(this).getOrElse(qctx.throwError(s"Expected a known value. \n\nThe value of: $show\ncould not be unlifted using $unlift", this))
4747

4848
/** Pattern matches `this` against `that`. Effectively performing a deep equality check.
4949
* It does the equivalent of
5050
* ```
5151
* this match
52-
* case '{...} => true // where the contens of the pattern are the contents of `that`
52+
* case '{...} => true // where the contents of the pattern are the contents of `that`
5353
* case _ => false
5454
* ```
5555
*/

library/src/scala/quoted/matching/ConstSeq.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object ConstSeq {
1616
* }
1717
* ```
1818
*/
19-
@deprecated("use scala.quoted.Varargs(scala.quoted.Const(_)) instead", "0.23.0")
19+
@deprecated("use scala.quoted.Varargs(scala.quoted.Consts(_)) instead", "0.23.0")
2020
def unapply[T](expr: Expr[Seq[T]])(using qctx: QuoteContext): Option[Seq[T]] =
2121
import scala.quoted.Const
2222
expr match

tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object E {
77

88
inline def eval[T](inline x: E[T]): T = ${ impl('x) }
99

10-
def impl[T: Type](x: Expr[E[T]]) (using QuoteContext): Expr[T] = x.value.lift
10+
def impl[T: Type](x: Expr[E[T]]) (using QuoteContext): Expr[T] = x.unliftOrError.lift
1111

1212
implicit def ev1[T: Type]: Unliftable[E[T]] = new Unliftable {
1313
def apply(x: Expr[E[T]]) (using QuoteContext): Option[E[T]] = x match {
@@ -18,7 +18,7 @@ object E {
1818
}
1919

2020
object Value {
21-
def unapply[T, U >: T](expr: Expr[T])(using Unliftable[U], QuoteContext): Option[U] = expr.getValue
21+
def unapply[T, U >: T](expr: Expr[T])(using Unliftable[U], QuoteContext): Option[U] = expr.unlift
2222
}
2323
}
2424

tests/neg-macros/inline-option/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import scala.quoted._
33

44
object Macro {
5-
def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.value match {
5+
def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.unliftOrError match {
66
case Some(i) => Expr(i)
77
case None => '{-1}
88
}

tests/neg-macros/inline-tuples-1/Macro_1.scala

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ import scala.quoted._
33
import scala.quoted.autolift.{given _}
44

55
object Macros {
6-
def tup1(tup: Expr[Tuple1[Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
7-
def tup2(tup: Expr[Tuple2[Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
8-
def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
9-
def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
10-
def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
11-
def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
12-
def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
13-
def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
14-
def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
15-
def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
16-
def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
17-
def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
18-
def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
19-
def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
20-
def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
21-
def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
22-
def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
23-
def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
24-
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 QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
25-
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 QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
26-
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 QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
27-
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 QuoteContext): Expr[Int] = tup.value.productIterator.map(_.asInstanceOf[Int]).sum
6+
def tup1(tup: Expr[Tuple1[Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
7+
def tup2(tup: Expr[Tuple2[Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
8+
def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
9+
def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
10+
def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
11+
def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
12+
def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
13+
def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
14+
def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
15+
def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
16+
def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
17+
def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
18+
def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
19+
def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
20+
def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
21+
def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
22+
def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
23+
def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
24+
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 QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
25+
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 QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
26+
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 QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
27+
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 QuoteContext): Expr[Int] = tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum
2828
}

tests/neg-macros/quote-error-2/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import quoted._
33
object Macro_1 {
44
inline def foo(inline b: Boolean): Unit = ${ fooImpl('b) }
55
def fooImpl(b: Expr[Boolean])(using QuoteContext): Expr[Unit] =
6-
'{println(${msg(b.value)})}
6+
'{println(${msg(b.unliftOrError)})}
77

88
def msg(b: Boolean)(using qctx: QuoteContext): Expr[String] =
99
if (b) '{"foo(true)"}

tests/neg-macros/quote-error/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import quoted._
33
object Macro_1 {
44
inline def foo(inline b: Boolean): Unit = ${fooImpl('b)}
55
def fooImpl(b: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] =
6-
if (b.value) '{println("foo(true)")}
6+
if (b.unliftOrError) '{println("foo(true)")}
77
else { qctx.error("foo cannot be called with false"); '{ ??? } }
88
}

tests/neg-macros/quote-exception/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import quoted._
33
object Macro_1 {
44
inline def foo(inline b: Boolean): Unit = ${fooImpl('b)}
55
def fooImpl(b: Expr[Boolean]) (using QuoteContext): Expr[Unit] =
6-
if (b.value) '{println("foo(true)")}
6+
if (b.unliftOrError) '{println("foo(true)")}
77
else ???
88
}

tests/neg-macros/quote-whitebox/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22

33
object Macros {
44
inline def defaultOf(inline str: String) <: Any = ${ defaultOfImpl('str) }
5-
def defaultOfImpl(str: Expr[String]) (using QuoteContext): Expr[Any] = str.value match {
5+
def defaultOfImpl(str: Expr[String]) (using QuoteContext): Expr[Any] = str.unliftOrError match {
66
case "int" => '{1}
77
case "string" => '{"a"}
88
}

tests/neg-macros/reflect-inline/assert_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ object api {
55
${ stripImpl('x) }
66

77
private def stripImpl(x: Expr[String])(using qctx: QuoteContext): Expr[String] =
8-
Expr(x.value.stripMargin)
8+
Expr(x.unliftOrError.stripMargin)
99

1010
}

tests/pos-macros/power-macro/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object PowerMacro {
66
inline def power(inline n: Long, x: Double) = ${powerCode('n, 'x)}
77

88
def powerCode(n: Expr[Long], x: Expr[Double]) (using QuoteContext): Expr[Double] =
9-
powerCode(n.value, x)
9+
powerCode(n.unliftOrError, x)
1010

1111
def powerCode(n: Long, x: Expr[Double])(using QuoteContext): Expr[Double] =
1212
if (n == 0) '{1.0}

tests/pos-macros/quote-nested-object/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ object Macro {
1010
inline def plus(inline n: Int, m: Int): Int = ${ plus('n, 'm) }
1111

1212
def plus(n: Expr[Int], m: Expr[Int]) (using QuoteContext): Expr[Int] =
13-
if (n.value == 0) m
13+
if (n.unliftOrError == 0) m
1414
else '{ ${n} + $m }
1515

1616
object Implementation2 {
1717

1818
inline def plus(inline n: Int, m: Int): Int = ${ plus('n, 'm) }
1919

2020
def plus(n: Expr[Int], m: Expr[Int]) (using QuoteContext): Expr[Int] =
21-
if (n.value == 0) m
21+
if (n.unliftOrError == 0) m
2222
else '{ ${n} + $m }
2323
}
2424
}

tests/pos-macros/quote-whitebox-2/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object Macro {
66
inline def charOrString(inline str: String) <: Any = ${ impl('str) }
77

88
def impl(strExpr: Expr[String]) (using QuoteContext)=
9-
val str = strExpr.value
9+
val str = strExpr.unliftOrError
1010
if (str.length == 1) Expr(str.charAt(0)) else Expr(str)
1111

1212
}

tests/pos-staging/quote-0.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object Macros {
1717
inline def power(inline n: Int, x: Double) = ${ powerCode('n, 'x) }
1818

1919
def powerCode(n: Expr[Int], x: Expr[Double]) (using QuoteContext): Expr[Double] =
20-
powerCode(n.value, x)
20+
powerCode(n.unliftOrError, x)
2121

2222
def powerCode(n: Int, x: Expr[Double])(using QuoteContext): Expr[Double] =
2323
if (n == 0) '{1.0}

tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ object TypeToolbox {
4444
inline def fieldIn[T](inline mem: String): String = ${fieldInImpl('[T], 'mem)}
4545
private def fieldInImpl(t: Type[_], mem: Expr[String])(using qctx: QuoteContext) : Expr[String] = {
4646
import qctx.tasty._
47-
val field = t.unseal.symbol.field(mem.value)
47+
val field = t.unseal.symbol.field(mem.unliftOrError)
4848
Expr(if field.isNoSymbol then "" else field.name)
4949
}
5050

@@ -58,7 +58,7 @@ object TypeToolbox {
5858
inline def methodIn[T](inline mem: String): Seq[String] = ${methodInImpl('[T], 'mem)}
5959
private def methodInImpl(t: Type[_], mem: Expr[String])(using qctx: QuoteContext) : Expr[Seq[String]] = {
6060
import qctx.tasty._
61-
Expr(t.unseal.symbol.classMethod(mem.value).map(_.name))
61+
Expr(t.unseal.symbol.classMethod(mem.unliftOrError).map(_.name))
6262
}
6363

6464
inline def methodsIn[T]: Seq[String] = ${methodsInImpl('[T])}
@@ -70,7 +70,7 @@ object TypeToolbox {
7070
inline def method[T](inline mem: String): Seq[String] = ${methodImpl('[T], 'mem)}
7171
private def methodImpl(t: Type[_], mem: Expr[String])(using qctx: QuoteContext) : Expr[Seq[String]] = {
7272
import qctx.tasty._
73-
Expr(t.unseal.symbol.method(mem.value).map(_.name))
73+
Expr(t.unseal.symbol.method(mem.unliftOrError).map(_.name))
7474
}
7575

7676
inline def methods[T]: Seq[String] = ${methodsImpl('[T])}

tests/run-macros/i4734/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Macros {
77
${ unrolledForeachImpl('seq, 'f, 'unrollSize) }
88

99
def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSizeExpr: Expr[Int]) (using QuoteContext): Expr[Unit] =
10-
unrolledForeachImpl(seq, f, unrollSizeExpr.value)
10+
unrolledForeachImpl(seq, f, unrollSizeExpr.unliftOrError)
1111

1212
def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSize: Int)(using QuoteContext): Expr[Unit] = '{
1313
val size = ($seq).length

tests/run-macros/i4735/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Macro {
1515
while (i < size) {
1616
println("<log> start loop")
1717
${
18-
for (j <- new UnrolledRange(0, unrollSize.value)) '{
18+
for (j <- new UnrolledRange(0, unrollSize.unliftOrError)) '{
1919
val element = ($seq)(i + ${j})
2020
${Expr.betaReduce(f)('element)} // or `($f)(element)` if `f` should not be inlined
2121
}

tests/run-macros/i4803/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22

33
object PowerMacro {
44
def powerCode(x: Expr[Double], n: Expr[Long]) (using QuoteContext): Expr[Double] =
5-
powerCode(x, n.value)
5+
powerCode(x, n.unliftOrError)
66

77
def powerCode(x: Expr[Double], n: Long) (using QuoteContext): Expr[Double] =
88
if (n == 0) '{1.0}

tests/run-macros/i4803b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22

33
object PowerMacro {
44
def powerCode(x: Expr[Double], n: Expr[Long]) (using QuoteContext): Expr[Double] =
5-
powerCode(x, n.value)
5+
powerCode(x, n.unliftOrError)
66

77
def powerCode(x: Expr[Double], n: Long) (using QuoteContext): Expr[Double] =
88
if (n == 0) '{1.0}

tests/run-macros/i4803c/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22

33
object PowerMacro {
44
def powerCode(x: Expr[Double], n: Expr[Long]) (using QuoteContext): Expr[Double] =
5-
powerCode(x, n.value)
5+
powerCode(x, n.unliftOrError)
66

77
def powerCode(x: Expr[Double], n: Long) (using QuoteContext): Expr[Double] =
88
if (n == 0) '{1.0}

tests/run-macros/i5188a/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import scala.quoted.autolift.{given _}
33

44
object Lib {
55
inline def sum(inline args: Int*): Int = ${ impl('args) }
6-
def impl(args: Expr[Seq[Int]]) (using QuoteContext): Expr[Int] = args.value.sum
6+
def impl(args: Expr[Seq[Int]]) (using QuoteContext): Expr[Int] = args.unliftOrError.sum
77
}

tests/run-macros/i6201/macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ inline def (inline x: String) strip: String =
44
${ stripImpl('x) }
55

66
def stripImpl(x: Expr[String])(using qctx: QuoteContext) : Expr[String] =
7-
Expr(x.value.stripMargin)
7+
Expr(x.unliftOrError.stripMargin)
88

99
inline def isHello(inline x: String): Boolean =
1010
${ isHelloImpl('x) }
1111

1212
def isHelloImpl(x: Expr[String])(using qctx: QuoteContext) : Expr[Boolean] =
13-
if (x.value == "hello") Expr(true) else Expr(false)
13+
if (x.unliftOrError == "hello") Expr(true) else Expr(false)

tests/run-macros/i6765-c/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import scala.quoted.{given _}
44
inline def foo(inline n: Int) = ${fooImpl('n)}
55

66
def fooImpl(n: Expr[Int])(using qctx: QuoteContext) = {
7-
val res = Expr.ofList(List.tabulate(n.value)(i => Expr("#" + i)))
7+
val res = Expr.ofList(List.tabulate(n.unliftOrError)(i => Expr("#" + i)))
88
'{ ${Expr(res.show)} + "\n" + $res.toString + "\n" }
99
}

tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object E {
77
inline def eval[T](inline x: E[T]): T = ${ impl('x) }
88

99
def impl[T: Type](expr: Expr[E[T]]) (using QuoteContext): Expr[T] =
10-
expr.value.lift
10+
expr.unliftOrError.lift
1111

1212
implicit def ev1[T: Type]: Unliftable[E[T]] = new Unliftable { // TODO use type class derivation
1313
def apply(x: Expr[E[T]]) (using QuoteContext): Option[E[T]] = (x match {
@@ -22,7 +22,7 @@ object E {
2222
}
2323

2424
object Value {
25-
def unapply[T, U >: T](expr: Expr[T])(using Unliftable[U], QuoteContext): Option[U] = expr.getValue
25+
def unapply[T, U >: T](expr: Expr[T])(using Unliftable[U], QuoteContext): Option[U] = expr.unlift
2626
}
2727

2828
}

tests/run-macros/inline-option/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import scala.quoted.autolift.{given _}
44

55
object Macros {
66

7-
def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.value match {
7+
def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.unliftOrError match {
88
case Some(i) => i
99
case None => '{-1}
1010
}
1111

12-
def impl2(opt: Expr[Option[Option[Int]]]) (using QuoteContext): Expr[Int] = impl(opt.value.flatten)
12+
def impl2(opt: Expr[Option[Option[Int]]]) (using QuoteContext): Expr[Int] = impl(opt.unliftOrError.flatten)
1313

1414
}

0 commit comments

Comments
 (0)