Skip to content

Commit fa662ec

Browse files
committed
Remove unnecessay given imports
1 parent f18a1e2 commit fa662ec

File tree

14 files changed

+36
-36
lines changed

14 files changed

+36
-36
lines changed

library/src-bootstrapped/dotty/internal/StringContextMacro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ object StringContextMacro {
5858
* @return the Expr containing the formatted and interpolated String or an error/warning if the parameters are not correct
5959
*/
6060
private def interpolate(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = {
61-
import qctx.tasty.{_, given _}
61+
import qctx.tasty._
6262
val sourceFile = strCtxExpr.unseal.pos.sourceFile
6363

6464
def notStatic =
@@ -135,7 +135,7 @@ object StringContextMacro {
135135
* @return the Expr containing the formatted and interpolated String or an error/warning report if the parameters are not correct
136136
*/
137137
def interpolate(parts0 : List[String], args : Seq[Expr[Any]], argsExpr: Expr[Seq[Any]], reporter : Reporter)(using qctx: QuoteContext) : Expr[String] = {
138-
import qctx.tasty.{_, given _}
138+
import qctx.tasty._
139139

140140
/** Checks if the number of arguments are the same as the number of formatting strings
141141
*

library/src/scala/internal/quoted/Expr.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object Expr {
3434
*/
3535
def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutineeExpr: scala.quoted.Expr[_])(using patternExpr: scala.quoted.Expr[_],
3636
hasTypeSplices: Boolean, qctx: QuoteContext): Option[Tup] = {
37-
import qctx.tasty.{_, given _}
37+
import qctx.tasty._
3838
new Matcher.QuoteMatcher[qctx.type].termMatch(scrutineeExpr.unseal, patternExpr.unseal, hasTypeSplices).asInstanceOf[Option[Tup]]
3939
}
4040

library/src/scala/internal/quoted/Matcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ private[quoted] object Matcher {
1313
// TODO use flag from qctx.tasty.rootContext. Maybe -debug or add -debug-macros
1414
private final val debug = false
1515

16-
import qctx.tasty.{_, given _}
16+
import qctx.tasty._
1717
import Matching._
1818

1919
/** A map relating equivalent symbols from the scrutinee and the pattern

library/src/scala/internal/quoted/Type.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object Type {
2626
*/
2727
def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutineeType: scala.quoted.Type[_])(using patternType: scala.quoted.Type[_],
2828
hasTypeSplices: Boolean, qctx: QuoteContext): Option[Tup] = {
29-
import qctx.tasty.{_, given _}
29+
import qctx.tasty._
3030
new Matcher.QuoteMatcher[qctx.type].typeTreeMatch(scrutineeType.unseal, patternType.unseal, hasTypeSplices).asInstanceOf[Option[Tup]]
3131
}
3232

library/src/scala/quoted/Const.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object Const {
1515
* ```
1616
*/
1717
def unapply[T](expr: Expr[T])(using qctx: QuoteContext): Option[T] = {
18-
import qctx.tasty.{_, given _}
18+
import qctx.tasty._
1919
def rec(tree: Term): Option[T] = tree match {
2020
case Literal(c) => Some(c.value.asInstanceOf[T])
2121
case Block(Nil, e) => rec(e)

library/src/scala/quoted/Expr.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ object Expr {
6161
* ```
6262
*/
6363
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 = {
64-
import qctx.tasty.{_, given _}
64+
import qctx.tasty._
6565
tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]])
6666
}
6767

@@ -74,19 +74,19 @@ object Expr {
7474
* ```
7575
*/
7676
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 = {
77-
import qctx.tasty.{_, given _}
77+
import qctx.tasty._
7878
tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]])
7979
}
8080

8181
/** Returns a null expresssion equivalent to `'{null}` */
8282
def nullExpr: QuoteContext ?=> Expr[Null] = qctx ?=> {
83-
import qctx.tasty.{_, given _}
83+
import qctx.tasty._
8484
Literal(Constant(null)).seal.asInstanceOf[Expr[Null]]
8585
}
8686

8787
/** Returns a unit expresssion equivalent to `'{}` or `'{()}` */
8888
def unitExpr: QuoteContext ?=> Expr[Unit] = qctx ?=> {
89-
import qctx.tasty.{_, given _}
89+
import qctx.tasty._
9090
Literal(Constant(())).seal.asInstanceOf[Expr[Unit]]
9191
}
9292

@@ -95,7 +95,7 @@ object Expr {
9595
* will be equivalent to `'{ $s1; $s2; ...; $e }`.
9696
*/
9797
def block[T](statements: List[Expr[_]], expr: Expr[T])(using qctx: QuoteContext): Expr[T] = {
98-
import qctx.tasty.{_, given _}
98+
import qctx.tasty._
9999
Block(statements.map(_.unseal), expr.unseal).seal.asInstanceOf[Expr[T]]
100100
}
101101

@@ -184,7 +184,7 @@ object Expr {
184184

185185
/** Given a tuple of the form `(Expr[A1], ..., Expr[An])`, outputs a tuple `Expr[(A1, ..., An)]`. */
186186
def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using qctx: QuoteContext): Expr[Tuple.InverseMap[T, Expr]] = {
187-
import qctx.tasty.{_, given _}
187+
import qctx.tasty._
188188
val elems: Seq[Expr[_]] = tup.asInstanceOf[Product].productIterator.toSeq.asInstanceOf[Seq[Expr[_]]]
189189
ofTuple(elems).cast[Tuple.InverseMap[T, Expr]]
190190
}
@@ -198,7 +198,7 @@ object Expr {
198198
* @param qctx current context
199199
*/
200200
def summon[T](using tpe: Type[T])(using qctx: QuoteContext): Option[Expr[T]] = {
201-
import qctx.tasty.{_, given _}
201+
import qctx.tasty._
202202
searchImplicit(tpe.unseal.tpe) match {
203203
case iss: ImplicitSearchSuccess => Some(iss.tree.seal.asInstanceOf[Expr[T]])
204204
case isf: ImplicitSearchFailure => None

library/src/scala/quoted/Lambda.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Lambda {
1616
* ```
1717
*/
1818
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] = {
19-
import qctx.tasty.{_, given _ }
19+
import qctx.tasty._
2020
val argTypes = functionType.unseal.tpe match
2121
case AppliedType(_, functionArguments) => functionArguments.init.asInstanceOf[List[Type]]
2222
qctx.tasty.internal.lambdaExtractor(expr.unseal, argTypes).map { fn =>

library/src/scala/quoted/Liftable.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ object Liftable {
3232
private class PrimitiveLiftable[T <: Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String] extends Liftable[T] {
3333
/** Lift a primitive value `n` into `'{ n }` */
3434
def toExpr(x: T) = qctx ?=> {
35-
import qctx.tasty.{_, given _}
35+
import qctx.tasty._
3636
Literal(Constant(x)).seal.asInstanceOf[Expr[T]]
3737
}
3838
}
3939

4040
given ClassIsLiftable[T] as Liftable[Class[T]] = new Liftable[Class[T]] {
4141
/** Lift a `Class[T]` into `'{ classOf[T] }` */
4242
def toExpr(x: Class[T]) = qctx ?=> {
43-
import qctx.tasty.{_, given _}
43+
import qctx.tasty._
4444
Ref(defn.Predef_classOf).appliedToType(Type(x)).seal.asInstanceOf[Expr[Class[T]]]
4545
}
4646
}

library/src/scala/quoted/QuoteContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import scala.quoted.show.SyntaxHighlight
88
* It contains the low-level Typed AST API `tasty` meta-programming API.
99
* This API does not have the static type guarantiees that `Expr` and `Type` provide.
1010
*
11-
* @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.tasty.{_, given _}; ... }`.
11+
* @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.tasty._; ... }`.
1212
*/
1313
class QuoteContext(val tasty: scala.tasty.Reflection) { self =>
1414

library/src/scala/quoted/Type.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,47 @@ class Type[T <: AnyKind] private[scala] {
2222
object Type {
2323

2424
given UnitTag(using qctx: QuoteContext) as Type[Unit] = {
25-
import qctx.tasty.{_, given _}
25+
import qctx.tasty._
2626
defn.UnitType.seal.asInstanceOf[quoted.Type[Unit]]
2727
}
2828

2929
given BooleanTag(using qctx: QuoteContext) as Type[Boolean] = {
30-
import qctx.tasty.{_, given _}
30+
import qctx.tasty._
3131
defn.BooleanType.seal.asInstanceOf[quoted.Type[Boolean]]
3232
}
3333

3434
given ByteTag(using qctx: QuoteContext) as Type[Byte] = {
35-
import qctx.tasty.{_, given _}
35+
import qctx.tasty._
3636
defn.ByteType.seal.asInstanceOf[quoted.Type[Byte]]
3737
}
3838

3939
given CharTag(using qctx: QuoteContext) as Type[Char] = {
40-
import qctx.tasty.{_, given _}
40+
import qctx.tasty._
4141
defn.CharType.seal.asInstanceOf[quoted.Type[Char]]
4242
}
4343

4444
given ShortTag(using qctx: QuoteContext) as Type[Short] = {
45-
import qctx.tasty.{_, given _}
45+
import qctx.tasty._
4646
defn.ShortType.seal.asInstanceOf[quoted.Type[Short]]
4747
}
4848

4949
given IntTag(using qctx: QuoteContext) as Type[Int] = {
50-
import qctx.tasty.{_, given _}
50+
import qctx.tasty._
5151
defn.IntType.seal.asInstanceOf[quoted.Type[Int]]
5252
}
5353

5454
given LongTag(using qctx: QuoteContext) as Type[Long] = {
55-
import qctx.tasty.{_, given _}
55+
import qctx.tasty._
5656
defn.LongType.seal.asInstanceOf[quoted.Type[Long]]
5757
}
5858

5959
given FloatTag(using qctx: QuoteContext) as Type[Float] = {
60-
import qctx.tasty.{_, given _}
60+
import qctx.tasty._
6161
defn.FloatType.seal.asInstanceOf[quoted.Type[Float]]
6262
}
6363

6464
given DoubleTag(using qctx: QuoteContext) as Type[Double] = {
65-
import qctx.tasty.{_, given _}
65+
import qctx.tasty._
6666
defn.DoubleType.seal.asInstanceOf[quoted.Type[Double]]
6767
}
6868

0 commit comments

Comments
 (0)