Skip to content

Commit 58ec69b

Browse files
committed
Remove scala.quoted.autolift
It has been discouraged to use this implicit conversion for a while as it interacts poorly with type inference. To avoid further issues we will simply remove it from the library.
1 parent 7723864 commit 58ec69b

File tree

83 files changed

+146
-237
lines changed

Some content is hidden

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

83 files changed

+146
-237
lines changed

docs/docs/reference/metaprogramming/macros.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,6 @@ def showExpr[T](expr: Expr[T])(using QuoteContext): Expr[String] = {
328328
That is, the `showExpr` method converts its `Expr` argument to a string (`code`), and lifts
329329
the result back to an `Expr[String]` using `Expr.apply`.
330330

331-
**Note**: Lifting `String` to `Expr[String]` using `Expr(code)` can be omitted by importing an implicit
332-
conversion with `import scala.quoted.autolift`. The programmer is able to
333-
declutter slightly the code at the cost of readable _phase distinction_ between
334-
stages.
335331

336332
### Lifting Types
337333

@@ -376,7 +372,8 @@ object Macros {
376372
${ assertImpl('expr) }
377373

378374
def assertImpl(expr: Expr[Boolean])(using QuoteContext) =
379-
'{ if !($expr) then throw new AssertionError("failed assertion: " + ${expr.show}) } // autolift is applied
375+
val failMsg: Expr[String] = Expr("failed assertion: " + expr.show)
376+
'{ if !($expr) then throw new AssertionError($failMsg) }
380377
}
381378

382379
object App {

library/src-bootstrapped/scala/quoted/autolift.scala

-4
This file was deleted.

tests/disabled/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Macros {
54

tests/disabled/run/xml-interpolation-3/XmlQuote_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
import scala.language.implicitConversions
54

tests/neg-macros/i6432/Macro_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
import scala.quoted._
3-
import scala.quoted.autolift
43

54

65
object Macro {

tests/neg-macros/i6432b/Macro_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
import scala.quoted._
3-
import scala.quoted.autolift
43

54

65
object Macro {

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
import scala.quoted._
3-
import scala.quoted.autolift
43

54

65
object E {
@@ -27,7 +26,7 @@ trait E[T] {
2726
}
2827

2928
case class I(n: Int) extends E[Int] {
30-
def lift (using QuoteContext): Expr[Int] = n
29+
def lift (using QuoteContext): Expr[Int] = Expr(n)
3130
}
3231

3332
case class Plus[T](x: E[T], y: E[T])(implicit op: Plus2[T]) extends E[T] {
+22-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11

22
import scala.quoted._
3-
import scala.quoted.autolift
43

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

tests/neg-macros/quote-interpolator-core-old.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
// This test checks the correct interpretation of the inlined value class
54

@@ -18,7 +17,7 @@ object FInterpolation {
1817
}
1918

2019
def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(using QuoteContext): Expr[String] = {
21-
val str: Expr[String] = sc.parts.mkString("")
20+
val str: Expr[String] = Expr(sc.parts.mkString(""))
2221
val args1: Expr[Seq[Any]] = liftSeq(args)
2322
'{ $str.format($args1: _*) }
2423
}

tests/neg-macros/quote-macro-splice.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Test {
54

65
inline def foo1: Int = { // error
76
println()
8-
${ impl(1) }
7+
${ impl('{1}) }
98
}
109

1110
inline def foo2: Int = { // error
12-
${ impl(1) }
13-
${ impl(2) }
11+
${ impl('{1}) }
12+
${ impl('{2}) }
1413
}
1514

1615
inline def foo3: Int = { // error
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Foo {
54
inline def foo(): Int = ${bar(${x})} // error
65
def x(using QuoteContext): Expr[Int] = '{1}
7-
def bar(i: Int)(using QuoteContext): Expr[Int] = i
6+
def bar(i: Int)(using QuoteContext): Expr[Int] = Expr(i)
87
}

tests/neg-staging/quote-run-in-macro-1/quoted_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import scala.quoted._
22
import scala.quoted.staging._
3-
import scala.quoted.autolift
43

54
object Macros {
65

tests/pending/run/tasty-comments/quoted_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43

54
object Macros {

tests/pos-macros/i6803b/Macro_1.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package blah
22

33
import scala.language.implicitConversions
44
import scala.quoted._
5-
import scala.quoted.autolift
65

76
object AsObject {
87
final class LineNo(val lineNo: Int)
@@ -11,7 +10,7 @@ object AsObject {
1110
inline given x as LineNo = ${impl}
1211
private def impl(using qctx: QuoteContext) : Expr[LineNo] = {
1312
import qctx.tasty._
14-
'{unsafe(${rootPosition.startLine})}
13+
'{unsafe(${Expr(rootPosition.startLine)})}
1514
}
1615
}
1716
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
import scala.quoted._
3-
import scala.quoted.autolift
43

54
object Macro {
65

tests/pos-staging/quote-0.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import scala.quoted._
22
import scala.quoted.staging._
3-
import scala.quoted.autolift
43

54
object Macros {
65

tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Foo {
54

tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Foo {
54

tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Macros {
54

tests/run-macros/f-interpolation-1/FQuote_1.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
import scala.language.implicitConversions
54

@@ -48,12 +47,12 @@ object FQuote {
4847

4948
for ((arg, part) <- allArgs.zip(parts.tail)) {
5049
if (part.startsWith("%d") && !(arg.tpe <:< defn.IntType)) {
51-
return '{s"`${${arg.show}}` is not of type Int"}
50+
return '{s"`${${Expr(arg.show)}}` is not of type Int"}
5251
}
5352

5453
}
5554

5655
val string = parts.mkString("")
57-
'{ new collection.immutable.StringOps(${string}).format($args: _*) }
56+
'{ new collection.immutable.StringOps(${Expr(string)}).format($args: _*) }
5857
}
5958
}

tests/run-macros/f-interpolator-neg/Macros_1.scala

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43

54
import scala.language.implicitConversions
@@ -33,25 +32,25 @@ object Macro {
3332
private[this] var oldReported = false
3433
def partError(message : String, index : Int, offset : Int) : Unit = {
3534
reported = true
36-
errors += '{ Tuple5(true, 0, $index, $offset, $message) }
35+
errors += '{ Tuple5(true, 0, ${Expr(index)}, ${Expr(offset)}, ${Expr(message)}) }
3736
}
3837
def partWarning(message : String, index : Int, offset : Int) : Unit = {
3938
reported = true
40-
errors += '{ Tuple5(false, 0, $index, $offset, $message) }
39+
errors += '{ Tuple5(false, 0, ${Expr(index)}, ${Expr(offset)}, ${Expr(message)}) }
4140
}
4241

4342
def argError(message : String, index : Int) : Unit = {
4443
reported = true
45-
errors += '{ Tuple5(true, 1, $index, 0, $message) }
44+
errors += '{ Tuple5(true, 1, ${Expr(index)}, 0, ${Expr(message)}) }
4645
}
4746

4847
def strCtxError(message : String) : Unit = {
4948
reported = true
50-
errors += '{ Tuple5(true, 2, -1, 0, $message) }
49+
errors += '{ Tuple5(true, 2, -1, 0, ${Expr(message)}) }
5150
}
5251
def argsError(message : String) : Unit = {
5352
reported = true
54-
errors += '{ Tuple5(true, 3, -1, 0, $message) }
53+
errors += '{ Tuple5(true, 3, -1, 0, ${Expr(message)}) }
5554
}
5655

5756
def hasReported() : Boolean = {

tests/run-macros/i4734/Macro_1.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import scala.annotation.tailrec
22
import scala.quoted._
3-
import scala.quoted.autolift
43

54
object Macros {
65
inline def unrolledForeach(seq: IndexedSeq[Int], f: => Int => Unit, inline unrollSize: Int): Unit = // or f: Int => Unit
@@ -11,17 +10,17 @@ object Macros {
1110

1211
def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSize: Int)(using QuoteContext): Expr[Unit] = '{
1312
val size = ($seq).length
14-
assert(size % (${unrollSize}) == 0) // for simplicity of the implementation
13+
assert(size % (${Expr(unrollSize)}) == 0) // for simplicity of the implementation
1514
var i = 0
1615
while (i < size) {
1716
${
1817
for (j <- new UnrolledRange(0, unrollSize)) '{
19-
val index = i + $j
18+
val index = i + ${Expr(j)}
2019
val element = ($seq)(index)
2120
${ Expr.betaReduce(f)('element) } // or `($f)(element)` if `f` should not be inlined
2221
}
2322
}
24-
i += ${unrollSize}
23+
i += ${Expr(unrollSize)}
2524
}
2625

2726
}

tests/run-macros/i4735/Macro_1.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.annotation.tailrec
2-
import scala.quoted.autolift
32

43
import scala.quoted._
54

@@ -16,7 +15,7 @@ object Macro {
1615
println("<log> start loop")
1716
${
1817
for (j <- new UnrolledRange(0, unrollSize.unliftOrError)) '{
19-
val element = ($seq)(i + ${j})
18+
val element = ($seq)(i + ${Expr(j)})
2019
${Expr.betaReduce(f)('element)} // or `($f)(element)` if `f` should not be inlined
2120
}
2221
}

tests/run-macros/i5119/Macro_1.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Macro {
54
class StringContextOps(sc: => StringContext) {
@@ -8,6 +7,6 @@ object Macro {
87
implicit inline def XmlQuote(inline sc: StringContext): StringContextOps = new StringContextOps(sc)
98
def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = {
109
import qctx.tasty._
11-
(sc.unseal.underlyingArgument.showExtractors + "\n" + args.unseal.underlyingArgument.showExtractors)
10+
Expr(sc.unseal.underlyingArgument.showExtractors + "\n" + args.unseal.underlyingArgument.showExtractors)
1211
}
1312
}

tests/run-macros/i5119b/Macro_1.scala

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43

54
object Macro {
65

76
inline def ff(arg1: Any, arg2: Any): String = ${ Macro.impl('{arg1}, '{arg2}) }
87

9-
def impl(arg1: Expr[Any], arg2: Expr[Any])(using qctx: QuoteContext) : Expr[String] = {
10-
import qctx.tasty._
11-
(arg1.unseal.underlyingArgument.showExtractors + "\n" + arg2.unseal.underlyingArgument.showExtractors)
12-
}
8+
def impl(arg1: Expr[Any], arg2: Expr[Any])(using qctx: QuoteContext) : Expr[String] =
9+
Expr(arg1.unseal.underlyingArgument.showExtractors + "\n" + arg2.unseal.underlyingArgument.showExtractors)
1310

1411
}

tests/run-macros/i5188a/Macro_1.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Lib {
54
inline def sum(inline args: Int*): Int = ${ impl('args) }
6-
def impl(args: Expr[Seq[Int]]) (using QuoteContext): Expr[Int] = args.unliftOrError.sum
5+
def impl(args: Expr[Seq[Int]]) (using QuoteContext): Expr[Int] = Expr(args.unliftOrError.sum)
76
}

tests/run-macros/i6518/Macro_1.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import scala.quoted._
2-
import scala.quoted.autolift
32

43
object Macros {
54

@@ -11,7 +10,7 @@ object Macros {
1110
classSym.classMethod("apply")
1211
classSym.classMethods
1312
classSym.method("apply")
14-
classSym.methods.map(_.name).sorted.mkString("\n")
13+
Expr(classSym.methods.map(_.name).sorted.mkString("\n"))
1514
}
1615

1716
}

tests/run-macros/inferred-repeated-result/test_1.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
object Macros {
22
import scala.quoted._
3-
import scala.quoted.autolift
43

54
inline def go[T](inline t: T) = ${ impl('t) }
65
def impl[T](expr: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = {
@@ -17,6 +16,6 @@ object Macros {
1716
s"$name : $returnType"
1817
}.sorted
1918

20-
methods.foldLeft('{}) { (res, m) => '{ $res; println(${m}) } }
19+
methods.foldLeft('{}) { (res, m) => '{ $res; println(${Expr(m)}) } }
2120
}
2221
}

0 commit comments

Comments
 (0)