Skip to content

Commit aa0f03e

Browse files
committed
Implement primitive liftable
1 parent 17ba04c commit aa0f03e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

library/src/scala/quoted/Liftable.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ abstract class Liftable[T] {
1313
* gives an alternative implementation using just the basic staging system.
1414
*/
1515
object Liftable {
16-
implicit def IntIsLiftable: Liftable[Int] = (x: Int) => new ValueExpr(x)
1716
implicit def BooleanIsLiftable: Liftable[Boolean] = (x: Boolean) => new ValueExpr(x)
17+
implicit def ByteLiftable: Liftable[Byte] = (x: Byte) => new ValueExpr(x)
18+
implicit def CharIsLiftable: Liftable[Char] = (x: Char) => new ValueExpr(x)
19+
implicit def ShortIsLiftable: Liftable[Short] = (x: Short) => new ValueExpr(x)
20+
implicit def IntIsLiftable: Liftable[Int] = (x: Int) => new ValueExpr(x)
21+
implicit def LongIsLiftable: Liftable[Long] = (x: Long) => new ValueExpr(x)
22+
implicit def FloatIsLiftable: Liftable[Float] = (x: Float) => new ValueExpr(x)
23+
implicit def DoubleIsLiftable: Liftable[Double] = (x: Double) => new ValueExpr(x)
1824
}

tests/pos/quote-liftable.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,14 @@ object Test {
2424
}
2525
}
2626

27+
(true: Expr[Boolean])
28+
(1: Expr[Byte])
29+
('a': Expr[Char])
30+
(1: Expr[Short])
31+
(1: Expr[Int])
32+
(1L: Expr[Long])
33+
(1.0f: Expr[Float])
34+
(1.0: Expr[Double])
35+
2736
val xs: Expr[List[Int]] = 1 :: 2 :: 3 :: Nil
2837
}

0 commit comments

Comments
 (0)