We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c2e5011 + 63c7f73 commit 540371dCopy full SHA for 540371d
library/src/scala/quoted/Liftable.scala
@@ -14,6 +14,10 @@ abstract class Liftable[T] {
14
*/
15
object Liftable {
16
17
+ implicit class LiftExprOps[T](val x: T) extends AnyVal {
18
+ def toExpr(implicit liftable: Liftable[T]): Expr[T] = liftable.toExpr(x)
19
+ }
20
+
21
final class ConstantExpr[T] private[Liftable](val value: T) extends Expr[T] {
22
override def toString: String = s"Expr($value)"
23
}
tests/pos/quote-lift.scala
@@ -0,0 +1,18 @@
1
+import scala.quoted._
2
3
+object Test {
4
+ '{ ~(1: Expr[Int]) }
5
6
+ '{ ~implicitly[Liftable[Int]].toExpr(1) }
7
8
+ {
9
+ import Liftable._
10
11
+ '{ ~IntIsLiftable.toExpr(1) }
12
13
+ '{ ~1.toExpr }
+}
0 commit comments