diff --git a/library/src-bootstrapped/dotty/internal/StringContextMacro.scala b/library/src-bootstrapped/dotty/internal/StringContextMacro.scala index ef13ca71a472..33ff256d6284 100644 --- a/library/src-bootstrapped/dotty/internal/StringContextMacro.scala +++ b/library/src-bootstrapped/dotty/internal/StringContextMacro.scala @@ -58,7 +58,7 @@ object StringContextMacro { * @return the Expr containing the formatted and interpolated String or an error/warning if the parameters are not correct */ private def interpolate(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ val sourceFile = strCtxExpr.unseal.pos.sourceFile def notStatic = @@ -135,7 +135,7 @@ object StringContextMacro { * @return the Expr containing the formatted and interpolated String or an error/warning report if the parameters are not correct */ def interpolate(parts0 : List[String], args : Seq[Expr[Any]], argsExpr: Expr[Seq[Any]], reporter : Reporter)(using qctx: QuoteContext) : Expr[String] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ /** Checks if the number of arguments are the same as the number of formatting strings * diff --git a/library/src/scala/internal/quoted/Expr.scala b/library/src/scala/internal/quoted/Expr.scala index a706f9d8d462..efd4be87d1c1 100644 --- a/library/src/scala/internal/quoted/Expr.scala +++ b/library/src/scala/internal/quoted/Expr.scala @@ -34,7 +34,7 @@ object Expr { */ def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutineeExpr: scala.quoted.Expr[_])(using patternExpr: scala.quoted.Expr[_], hasTypeSplices: Boolean, qctx: QuoteContext): Option[Tup] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ new Matcher.QuoteMatcher[qctx.type].termMatch(scrutineeExpr.unseal, patternExpr.unseal, hasTypeSplices).asInstanceOf[Option[Tup]] } diff --git a/library/src/scala/internal/quoted/Matcher.scala b/library/src/scala/internal/quoted/Matcher.scala index ab69eb7e91f0..39bd7d6b9523 100644 --- a/library/src/scala/internal/quoted/Matcher.scala +++ b/library/src/scala/internal/quoted/Matcher.scala @@ -13,7 +13,7 @@ private[quoted] object Matcher { // TODO use flag from qctx.tasty.rootContext. Maybe -debug or add -debug-macros private final val debug = false - import qctx.tasty.{_, given _} + import qctx.tasty._ import Matching._ /** A map relating equivalent symbols from the scrutinee and the pattern diff --git a/library/src/scala/internal/quoted/Type.scala b/library/src/scala/internal/quoted/Type.scala index c3af769c8f3a..4d6e35809c46 100644 --- a/library/src/scala/internal/quoted/Type.scala +++ b/library/src/scala/internal/quoted/Type.scala @@ -26,7 +26,7 @@ object Type { */ def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutineeType: scala.quoted.Type[_])(using patternType: scala.quoted.Type[_], hasTypeSplices: Boolean, qctx: QuoteContext): Option[Tup] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ new Matcher.QuoteMatcher[qctx.type].typeTreeMatch(scrutineeType.unseal, patternType.unseal, hasTypeSplices).asInstanceOf[Option[Tup]] } diff --git a/library/src/scala/quoted/Const.scala b/library/src/scala/quoted/Const.scala index bf38d07fcae5..6d51cd897999 100644 --- a/library/src/scala/quoted/Const.scala +++ b/library/src/scala/quoted/Const.scala @@ -15,7 +15,7 @@ object Const { * ``` */ def unapply[T](expr: Expr[T])(using qctx: QuoteContext): Option[T] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ def rec(tree: Term): Option[T] = tree match { case Literal(c) => Some(c.value.asInstanceOf[T]) case Block(Nil, e) => rec(e) diff --git a/library/src/scala/quoted/Expr.scala b/library/src/scala/quoted/Expr.scala index 0fa72f928ef1..34cfdd0a4f68 100644 --- a/library/src/scala/quoted/Expr.scala +++ b/library/src/scala/quoted/Expr.scala @@ -61,7 +61,7 @@ object Expr { * ``` */ def betaReduce[F, Args <: Tuple, R, G](f: Expr[F])(using tf: TupledFunction[F, Args => R], tg: TupledFunction[G, TupleOfExpr[Args] => Expr[R]], qctx: QuoteContext): G = { - import qctx.tasty.{_, given _} + import qctx.tasty._ tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]]) } @@ -74,19 +74,19 @@ object Expr { * ``` */ def betaReduceGiven[F, Args <: Tuple, R, G](f: Expr[F])(using tf: TupledFunction[F, Args ?=> R], tg: TupledFunction[G, TupleOfExpr[Args] => Expr[R]], qctx: QuoteContext): G = { - import qctx.tasty.{_, given _} + import qctx.tasty._ tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]]) } /** Returns a null expresssion equivalent to `'{null}` */ def nullExpr: QuoteContext ?=> Expr[Null] = qctx ?=> { - import qctx.tasty.{_, given _} + import qctx.tasty._ Literal(Constant(null)).seal.asInstanceOf[Expr[Null]] } /** Returns a unit expresssion equivalent to `'{}` or `'{()}` */ def unitExpr: QuoteContext ?=> Expr[Unit] = qctx ?=> { - import qctx.tasty.{_, given _} + import qctx.tasty._ Literal(Constant(())).seal.asInstanceOf[Expr[Unit]] } @@ -95,7 +95,7 @@ object Expr { * will be equivalent to `'{ $s1; $s2; ...; $e }`. */ def block[T](statements: List[Expr[_]], expr: Expr[T])(using qctx: QuoteContext): Expr[T] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ Block(statements.map(_.unseal), expr.unseal).seal.asInstanceOf[Expr[T]] } @@ -184,7 +184,7 @@ object Expr { /** Given a tuple of the form `(Expr[A1], ..., Expr[An])`, outputs a tuple `Expr[(A1, ..., An)]`. */ def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using qctx: QuoteContext): Expr[Tuple.InverseMap[T, Expr]] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ val elems: Seq[Expr[_]] = tup.asInstanceOf[Product].productIterator.toSeq.asInstanceOf[Seq[Expr[_]]] ofTuple(elems).cast[Tuple.InverseMap[T, Expr]] } @@ -198,7 +198,7 @@ object Expr { * @param qctx current context */ def summon[T](using tpe: Type[T])(using qctx: QuoteContext): Option[Expr[T]] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ searchImplicit(tpe.unseal.tpe) match { case iss: ImplicitSearchSuccess => Some(iss.tree.seal.asInstanceOf[Expr[T]]) case isf: ImplicitSearchFailure => None diff --git a/library/src/scala/quoted/Lambda.scala b/library/src/scala/quoted/Lambda.scala index dd22aa06a9df..ccbdc70c9773 100644 --- a/library/src/scala/quoted/Lambda.scala +++ b/library/src/scala/quoted/Lambda.scala @@ -16,7 +16,7 @@ object Lambda { * ``` */ def unapply[F, Args <: Tuple, Res, G](expr: Expr[F])(using qctx: QuoteContext, tf: TupledFunction[F, Args => Res], tg: TupledFunction[G, Tuple.Map[Args, Expr] => Expr[Res]], functionType: Type[F]): Option[/*QuoteContext ?=>*/ G] = { - import qctx.tasty.{_, given _ } + import qctx.tasty._ val argTypes = functionType.unseal.tpe match case AppliedType(_, functionArguments) => functionArguments.init.asInstanceOf[List[Type]] qctx.tasty.internal.lambdaExtractor(expr.unseal, argTypes).map { fn => diff --git a/library/src/scala/quoted/Liftable.scala b/library/src/scala/quoted/Liftable.scala index a755c03e7c54..33e627dd9067 100644 --- a/library/src/scala/quoted/Liftable.scala +++ b/library/src/scala/quoted/Liftable.scala @@ -32,7 +32,7 @@ object Liftable { private class PrimitiveLiftable[T <: Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String] extends Liftable[T] { /** Lift a primitive value `n` into `'{ n }` */ def toExpr(x: T) = qctx ?=> { - import qctx.tasty.{_, given _} + import qctx.tasty._ Literal(Constant(x)).seal.asInstanceOf[Expr[T]] } } @@ -40,7 +40,7 @@ object Liftable { given ClassIsLiftable[T] as Liftable[Class[T]] = new Liftable[Class[T]] { /** Lift a `Class[T]` into `'{ classOf[T] }` */ def toExpr(x: Class[T]) = qctx ?=> { - import qctx.tasty.{_, given _} + import qctx.tasty._ Ref(defn.Predef_classOf).appliedToType(Type(x)).seal.asInstanceOf[Expr[Class[T]]] } } diff --git a/library/src/scala/quoted/QuoteContext.scala b/library/src/scala/quoted/QuoteContext.scala index 56abb57f5689..8cca608ec2ec 100644 --- a/library/src/scala/quoted/QuoteContext.scala +++ b/library/src/scala/quoted/QuoteContext.scala @@ -8,7 +8,7 @@ import scala.quoted.show.SyntaxHighlight * It contains the low-level Typed AST API `tasty` meta-programming API. * This API does not have the static type guarantiees that `Expr` and `Type` provide. * - * @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.tasty.{_, given _}; ... }`. + * @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.tasty._; ... }`. */ class QuoteContext(val tasty: scala.tasty.Reflection) { self => diff --git a/library/src/scala/quoted/Type.scala b/library/src/scala/quoted/Type.scala index 00a7c844e53f..c2074f0a9f14 100644 --- a/library/src/scala/quoted/Type.scala +++ b/library/src/scala/quoted/Type.scala @@ -22,47 +22,47 @@ class Type[T <: AnyKind] private[scala] { object Type { given UnitTag(using qctx: QuoteContext) as Type[Unit] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.UnitType.seal.asInstanceOf[quoted.Type[Unit]] } given BooleanTag(using qctx: QuoteContext) as Type[Boolean] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.BooleanType.seal.asInstanceOf[quoted.Type[Boolean]] } given ByteTag(using qctx: QuoteContext) as Type[Byte] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.ByteType.seal.asInstanceOf[quoted.Type[Byte]] } given CharTag(using qctx: QuoteContext) as Type[Char] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.CharType.seal.asInstanceOf[quoted.Type[Char]] } given ShortTag(using qctx: QuoteContext) as Type[Short] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.ShortType.seal.asInstanceOf[quoted.Type[Short]] } given IntTag(using qctx: QuoteContext) as Type[Int] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.IntType.seal.asInstanceOf[quoted.Type[Int]] } given LongTag(using qctx: QuoteContext) as Type[Long] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.LongType.seal.asInstanceOf[quoted.Type[Long]] } given FloatTag(using qctx: QuoteContext) as Type[Float] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.FloatType.seal.asInstanceOf[quoted.Type[Float]] } given DoubleTag(using qctx: QuoteContext) as Type[Double] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ defn.DoubleType.seal.asInstanceOf[quoted.Type[Double]] } diff --git a/library/src/scala/quoted/Varargs.scala b/library/src/scala/quoted/Varargs.scala index 39034ae6b582..c221f9393b94 100644 --- a/library/src/scala/quoted/Varargs.scala +++ b/library/src/scala/quoted/Varargs.scala @@ -16,7 +16,7 @@ object Varargs { * ``` */ def apply[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: QuoteContext): Expr[Seq[T]] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ Repeated(xs.map[Term](_.unseal).toList, tp.unseal).seal.asInstanceOf[Expr[Seq[T]]] } @@ -33,7 +33,7 @@ object Varargs { * ``` */ def unapply[T](expr: Expr[Seq[T]])(using qctx: QuoteContext): Option[Seq[Expr[T]]] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ def rec(tree: Term): Option[Seq[Expr[T]]] = tree match { case Typed(Repeated(elems, _), _) => Some(elems.map(x => x.seal.asInstanceOf[Expr[T]])) case Block(Nil, e) => rec(e) diff --git a/library/src/scala/quoted/matching/Sym.scala b/library/src/scala/quoted/matching/Sym.scala index 68cd3a9edc5b..3fe0fbe8e7ee 100644 --- a/library/src/scala/quoted/matching/Sym.scala +++ b/library/src/scala/quoted/matching/Sym.scala @@ -22,7 +22,7 @@ class Sym[T <: AnyKind] private[scala](val name: String, private[Sym] val id: Ob object Sym { def unapply[T](expr: Expr[T])(using qctx: QuoteContext): Option[Sym[T]] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ expr.unseal match { case ref: Ident => val sym = ref.symbol diff --git a/library/src/scala/quoted/unsafe/UnsafeExpr.scala b/library/src/scala/quoted/unsafe/UnsafeExpr.scala index fb3d62e85209..4a8db58d514d 100644 --- a/library/src/scala/quoted/unsafe/UnsafeExpr.scala +++ b/library/src/scala/quoted/unsafe/UnsafeExpr.scala @@ -20,7 +20,7 @@ object UnsafeExpr { * change the parameter semantics as by-value parameter could be re-evaluated. */ def underlyingArgument[T](expr: Expr[T])(using qctx: QuoteContext): Expr[T] = { - import qctx.tasty.{given _, _} + import qctx.tasty._ expr.unseal.underlyingArgument.seal.asInstanceOf[Expr[T]] } @@ -39,31 +39,31 @@ object UnsafeExpr { * ``` */ def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using qctx: QuoteContext): X = { - import qctx.tasty.{given _, _} + import qctx.tasty._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.unseal, params, List(v.unseal)).seal.asInstanceOf[Expr[t]]) } def open[T1, T2, R, X](f: Expr[(T1, T2) => R])(content: (Expr[R], [t] => Expr[t] => (Expr[T1], Expr[T2]) => Expr[t]) => X)(using qctx: QuoteContext)(using DummyImplicit): X = { - import qctx.tasty.{given _, _} + import qctx.tasty._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2]) => bodyFn[t](e.unseal, params, List(v1.unseal, v2.unseal)).seal.asInstanceOf[Expr[t]]) } def open[T1, T2, T3, R, X](f: Expr[(T1, T2, T3) => R])(content: (Expr[R], [t] => Expr[t] => (Expr[T1], Expr[T2], Expr[T3]) => Expr[t]) => X)(using qctx: QuoteContext)(using DummyImplicit, DummyImplicit): X = { - import qctx.tasty.{given _, _} + import qctx.tasty._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2], v3: Expr[T3]) => bodyFn[t](e.unseal, params, List(v1.unseal, v2.unseal, v3.unseal)).seal.asInstanceOf[Expr[t]]) } private def paramsAndBody[R](using qctx: QuoteContext)(f: Expr[Any]): (List[qctx.tasty.ValDef], Expr[R]) = { - import qctx.tasty.{given _, _} + import qctx.tasty._ val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.unseal.etaExpand (params, body.seal.asInstanceOf[Expr[R]]) } private def bodyFn[t](using qctx: QuoteContext)(e: qctx.tasty.Term, params: List[qctx.tasty.ValDef], args: List[qctx.tasty.Term]): qctx.tasty.Term = { - import qctx.tasty.{given _, _} + import qctx.tasty._ val map = params.map(_.symbol).zip(args).toMap new TreeMap { override def transformTerm(tree: Term)(using ctx: Context): Term = diff --git a/library/src/scala/quoted/util/ExprMap.scala b/library/src/scala/quoted/util/ExprMap.scala index 2d262c9d76a3..aba68634bd35 100644 --- a/library/src/scala/quoted/util/ExprMap.scala +++ b/library/src/scala/quoted/util/ExprMap.scala @@ -9,7 +9,7 @@ trait ExprMap { /** Map subexpressions an expression `e` with a type `tpe` */ def transformChildren[T](e: Expr[T])(using qctx: QuoteContext, tpe: Type[T]): Expr[T] = { - import qctx.tasty.{_, given _} + import qctx.tasty._ final class MapChildren() { def transformStatement(tree: Statement)(using ctx: Context): Statement = { diff --git a/project/Build.scala b/project/Build.scala index 40daa1ec6974..7c8245e96d0a 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -62,7 +62,7 @@ object MyScalaJSPlugin extends AutoPlugin { } object Build { - val referenceVersion = "0.23.0-bin-20200222-811dc19-NIGHTLY" + val referenceVersion = "0.23.0-bin-20200305-84f2e41-NIGHTLY" val baseVersion = "0.23.0" val baseSbtDottyVersion = "0.4.0"