From d3dc9c529aa87a0f2d486aa03e61252b766a4677 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 16 Mar 2018 18:02:49 +0100 Subject: [PATCH] Move LiftExprOps to quoted package To use `import scala.quotes._` to import `toExpr` extension --- library/src/scala/quoted/Liftable.scala | 5 ----- library/src/scala/quoted/package.scala | 9 +++++++++ tests/run-with-compiler/quote-lib.scala | 1 - tests/run-with-compiler/quote-show-blocks-raw.scala | 1 - tests/run-with-compiler/quote-show-blocks.scala | 1 - 5 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 library/src/scala/quoted/package.scala diff --git a/library/src/scala/quoted/Liftable.scala b/library/src/scala/quoted/Liftable.scala index 2419f44405e1..6fdd1bacebc8 100644 --- a/library/src/scala/quoted/Liftable.scala +++ b/library/src/scala/quoted/Liftable.scala @@ -15,11 +15,6 @@ abstract class Liftable[T] { * gives an alternative implementation using just the basic staging system. */ object Liftable { - - implicit class LiftExprOps[T](val x: T) extends AnyVal { - def toExpr(implicit liftable: Liftable[T]): Expr[T] = liftable.toExpr(x) - } - implicit def BooleanIsLiftable: Liftable[Boolean] = (x: Boolean) => new ValueExpr(x) implicit def ByteLiftable: Liftable[Byte] = (x: Byte) => new ValueExpr(x) implicit def CharIsLiftable: Liftable[Char] = (x: Char) => new ValueExpr(x) diff --git a/library/src/scala/quoted/package.scala b/library/src/scala/quoted/package.scala new file mode 100644 index 000000000000..3a1be2f5f5e1 --- /dev/null +++ b/library/src/scala/quoted/package.scala @@ -0,0 +1,9 @@ +package scala + +package object quoted { + + implicit class LiftExprOps[T](val x: T) extends AnyVal { + def toExpr(implicit ev: Liftable[T]): Expr[T] = ev.toExpr(x) + } + +} diff --git a/tests/run-with-compiler/quote-lib.scala b/tests/run-with-compiler/quote-lib.scala index 630b2df6d7d2..5312528c8b4e 100644 --- a/tests/run-with-compiler/quote-lib.scala +++ b/tests/run-with-compiler/quote-lib.scala @@ -42,7 +42,6 @@ object Test { package liftable { import scala.quoted.Liftable - import scala.quoted.Liftable._ import scala.reflect.ClassTag object Exprs { diff --git a/tests/run-with-compiler/quote-show-blocks-raw.scala b/tests/run-with-compiler/quote-show-blocks-raw.scala index f41be403d69b..bcd6480451dc 100644 --- a/tests/run-with-compiler/quote-show-blocks-raw.scala +++ b/tests/run-with-compiler/quote-show-blocks-raw.scala @@ -2,7 +2,6 @@ import dotty.tools.dotc.quoted.Toolbox._ import scala.quoted._ -import scala.quoted.Liftable._ object Test { def main(args: Array[String]): Unit = { diff --git a/tests/run-with-compiler/quote-show-blocks.scala b/tests/run-with-compiler/quote-show-blocks.scala index 0c99149934f8..1b84dde97a9c 100644 --- a/tests/run-with-compiler/quote-show-blocks.scala +++ b/tests/run-with-compiler/quote-show-blocks.scala @@ -2,7 +2,6 @@ import dotty.tools.dotc.quoted.Toolbox._ import scala.quoted._ -import scala.quoted.Liftable._ object Test { def main(args: Array[String]): Unit = {