Skip to content

Commit 2e6e6d3

Browse files
Merge pull request #4123 from dotty-staging/remove-unit-lifter
Remove quoted.Liftable for Unit
2 parents aa8d292 + 44259c6 commit 2e6e6d3

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

library/src/scala/quoted/Liftable.scala

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ object Liftable {
2020
def toExpr(implicit liftable: Liftable[T]): Expr[T] = liftable.toExpr(x)
2121
}
2222

23-
implicit def UnitIsLiftable: Liftable[Unit] = (x: Unit) => new ValueExpr(x)
2423
implicit def BooleanIsLiftable: Liftable[Boolean] = (x: Boolean) => new ValueExpr(x)
2524
implicit def ByteLiftable: Liftable[Byte] = (x: Byte) => new ValueExpr(x)
2625
implicit def CharIsLiftable: Liftable[Char] = (x: Char) => new ValueExpr(x)
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import scala.quoted._
22
object Macro {
33
inline def ff: Unit = ~impl('[Int])
4-
def impl(t: Type[Int]): Expr[Unit] = ()
5-
}
4+
def impl(t: Type[Int]): Expr[Unit] = '()
5+
}

tests/pos/quote-liftable.scala

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ object Test {
3333
(1.0f: Expr[Float])
3434
(1.0: Expr[Double])
3535
("abc": Expr[String])
36-
((): Expr[Unit])
3736

3837
val xs: Expr[List[Int]] = 1 :: 2 :: 3 :: Nil
3938
}

tests/run-with-compiler/i3946.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import dotty.tools.dotc.quoted.Toolbox._
22
import scala.quoted._
33
object Test {
44
def main(args: Array[String]): Unit = {
5-
val u: Expr[Unit] = ()
5+
val u: Expr[Unit] = '()
66
println(u.show)
77
println(u.run)
88
}

tests/run-with-compiler/quote-show-blocks-raw.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ object Test {
1212
if (n == 0) x
1313
else a(n - 1, '{ println(~n.toExpr); ~x })
1414

15-
println(a(5, ()).show)
15+
println(a(5, '()).show)
1616

1717

1818
def b(n: Int, x: Expr[Unit]): Expr[Unit] =
1919
if (n == 0) x
2020
else b(n - 1, '{ ~x; println(~n.toExpr) })
2121

22-
println(b(5, ()).show)
22+
println(b(5, '()).show)
2323
}
2424

2525
}

tests/run-with-compiler/quote-show-blocks.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ object Test {
1111
if (n == 0) x
1212
else a(n - 1, '{ println(~n.toExpr); ~x })
1313

14-
println(a(5, ()).show)
14+
println(a(5, '()).show)
1515

1616

1717
def b(n: Int, x: Expr[Unit]): Expr[Unit] =
1818
if (n == 0) x
1919
else b(n - 1, '{ ~x; println(~n.toExpr) })
2020

21-
println(b(5, ()).show)
21+
println(b(5, '()).show)
2222
}
2323

2424
}

0 commit comments

Comments
 (0)