Skip to content

Commit 5f744f2

Browse files
committed
Drop more outdated import given selectors
1 parent 909d854 commit 5f744f2

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

docs/docs/reference/contextual/derivation-macro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ from the signature. The body of the `derived` method is shown below:
4242

4343
```scala
4444
given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
45-
import qctx.tasty.{_, given}
45+
import qctx.tasty.{_, given _}
4646

4747
val ev: Expr[Mirror.Of[T]] = summonExpr(using '[Mirror.Of[T]]).get
4848

@@ -176,7 +176,7 @@ object Eq {
176176
}
177177

178178
given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
179-
import qctx.tasty.{_, given}
179+
import qctx.tasty.{_, given _}
180180

181181
val ev: Expr[Mirror.Of[T]] = summonExpr(using '[Mirror.Of[T]]).get
182182

docs/docs/reference/metaprogramming/macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Here’s a compiler that maps an expression given in the interpreted
221221
language to quoted Scala code of type `Expr[Int]`.
222222
The compiler takes an environment that maps variable names to Scala `Expr`s.
223223
```scala
224-
import scala.quoted.{given, _}
224+
import scala.quoted.{given _, _}
225225

226226
def compile(e: Exp, env: Map[String, Expr[Int]]): Expr[Int] = e match {
227227
case Num(n) =>

docs/docs/reference/metaprogramming/tasty-reflect.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ import scala.quoted._
2929
inline def natConst(x: => Int): Int = ${natConstImpl('{x})}
3030

3131
def natConstImpl(x: Expr[Int])(using qctx: QuoteContext): Expr[Int] = {
32-
import qctx.tasty.{_, given}
32+
import qctx.tasty.{_, given _}
3333
...
3434
}
3535
```
3636

3737
### Sealing and Unsealing
3838

39-
`import qctx.tasty.{_, given}` will provide an `unseal` extension method on `quoted.Expr`
39+
`import qctx.tasty.{_, given _}` will provide an `unseal` extension method on `quoted.Expr`
4040
and `quoted.Type` which returns a `qctx.tasty.Term` that represents the tree of
4141
the expression and `qctx.tasty.TypeTree` that represents the tree of the type
4242
respectively. It will also import all extractors and methods on TASTy Reflect
4343
trees. For example the `Literal(_)` extractor used below.
4444

4545
```scala
4646
def natConstImpl(x: Expr[Int])(using qctx: QuoteContext): Expr[Int] = {
47-
import qctx.tasty.{_, given}
47+
import qctx.tasty.{_, given _}
4848
val xTree: Term = x.unseal
4949
xTree match {
5050
case Inlined(_, _, Literal(Constant(n: Int))) =>
@@ -81,7 +81,7 @@ operation expression passed while calling the `macro` below.
8181
inline def macro(param: => Boolean): Unit = ${ macroImpl('param) }
8282

8383
def macroImpl(param: Expr[Boolean])(using qctx: QuoteContext): Expr[Unit] = {
84-
import qctx.tasty.{_, given}
84+
import qctx.tasty.{_, given _}
8585
import util._
8686

8787
param.unseal.underlyingArgument match {
@@ -103,7 +103,7 @@ point.
103103

104104
```scala
105105
def macroImpl()(qctx: QuoteContext): Expr[Unit] = {
106-
import qctx.tasty.{_, given}
106+
import qctx.tasty.{_, given _}
107107
val pos = rootPosition
108108

109109
val path = pos.sourceFile.jpath.toString

library/src/scala/tasty/reflect/TreeTraverser.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package reflect
77
* ```
88
* class MyTraverser[R <: scala.tasty.Reflection & Singleton](val reflect: R)
99
* extends scala.tasty.reflect.TreeTraverser {
10-
* import reflect.{given, _}
10+
* import reflect.{given _, _}
1111
* override def traverseTree(tree: Tree)(using ctx: Context): Unit = ...
1212
* }
1313
* ```

sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Main extends App {
77

88
val inspector = new TastyInspector {
99
protected def processCompilationUnit(reflect: Reflection)(root: reflect.Tree): Unit = {
10-
import reflect.{given, _}
10+
import reflect.{given _, _}
1111
val tastyStr = root.show
1212
println(tastyStr)
1313
}

tastydoc/src/dotty/tastydoc/TastyExtractor.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import dotty.tastydoc.representations._
88
/** A trait containing useful methods for extracting information from the reflect API */
99
trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentCleaner{
1010
def extractPath(reflect: Reflection)(symbol: reflect.Symbol) : List[String] = {
11-
import reflect.{given, _}
11+
import reflect.{given _, _}
1212

1313
val pathArray = symbol.show.split("\\.") // NOTE: this should print w/o colors, inspect afterwards
1414
pathArray.iterator.slice(0, pathArray.length - 1).toList
1515
}
1616

1717
def extractModifiers(reflect: Reflection)(flags: reflect.Flags, privateWithin: Option[reflect.Type], protectedWithin: Option[reflect.Type]) : (List[String], Option[Reference], Option[Reference]) = {
18-
import reflect.{given, _}
18+
import reflect.{given _, _}
1919

2020
(((if(flags.is(Flags.Override)) "override" else "") ::
2121
(if(flags.is(Flags.Private)) "private" else "")::
@@ -40,7 +40,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
4040
}
4141

4242
def extractComments(reflect: Reflection)(comment: Option[reflect.Comment], rep: Representation) : (Map[String, EmulatedPackageRepresentation], String) => Option[Comment] = {
43-
import reflect.{given, _}
43+
import reflect.{given _, _}
4444

4545
comment match {
4646
case Some(com) =>
@@ -59,7 +59,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
5959
}
6060

6161
def extractClassMembers(reflect: Reflection)(body: List[reflect.Statement], symbol: reflect.Symbol, parentRepresentation: Some[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) : List[Representation with Modifiers] = {
62-
import reflect.{given, _}
62+
import reflect.{given _, _}
6363

6464
/** Filter fields which shouldn't be displayed in the doc
6565
*/
@@ -99,7 +99,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
9999
}
100100

101101
def extractParents(reflect: Reflection)(parents: List[reflect.Tree]): List[Reference] = {
102-
import reflect.{given, _}
102+
import reflect.{given _, _}
103103

104104
val parentsReferences = parents.map{
105105
case c: TypeTree => convertTypeToReference(reflect)(c.tpe)
@@ -118,7 +118,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
118118
* @return (is case, is a trait, is an object, the kind as a String)
119119
*/
120120
def extractKind(reflect: Reflection)(flags: reflect.Flags): (Boolean, Boolean, Boolean, String) = {
121-
import reflect.{given, _}
121+
import reflect.{given _, _}
122122

123123
val isCase = flags.is(reflect.Flags.Case)
124124
val isTrait = flags.is(reflect.Flags.Trait)
@@ -143,7 +143,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
143143
}
144144

145145
def extractCompanion(reflect: Reflection)(companionModule: Option[reflect.Symbol], companionClass: Option[reflect.Symbol], companionIsObject: Boolean): Option[CompanionReference] = {
146-
import reflect.{given, _}
146+
import reflect.{given _, _}
147147

148148
if(companionIsObject){
149149
companionModule match {
@@ -165,7 +165,7 @@ trait TastyExtractor extends TastyTypeConverter with CommentParser with CommentC
165165
}
166166

167167
def extractAnnotations(reflect: Reflection)(annots: List[reflect.Term]): List[TypeReference] = {
168-
import reflect.{given, _}
168+
import reflect.{given _, _}
169169

170170
def keepAnnot(label: String, link: String): Boolean = {
171171
!(label == "SourceFile" && link == "/internal") &&

tastydoc/src/dotty/tastydoc/TastyTypeConverter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import dotty.tastydoc.references._
77
trait TastyTypeConverter {
88

99
def convertTypeOrBoundsToReference(reflect: Reflection)(typeOrBounds: reflect.TypeOrBounds): Reference = {
10-
import reflect.{given, _}
10+
import reflect.{given _, _}
1111

1212
def anyOrNothing(reference: Reference): Boolean = reference match {
1313
case TypeReference("Any", "/scala", _, _) => true
@@ -30,7 +30,7 @@ trait TastyTypeConverter {
3030
}
3131

3232
def convertTypeToReference(reflect: Reflection)(tp: reflect.Type): Reference = {
33-
import reflect.{given, _}
33+
import reflect.{given _, _}
3434

3535
//Inner method to avoid passing the reflection each time
3636
def inner(tp: reflect.Type): Reference = tp match {

tastydoc/src/dotty/tastydoc/representations.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ object representations extends TastyExtractor {
8383
}
8484

8585
class PackageRepresentation(reflect: Reflection, internal: reflect.PackageClause, override val parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) extends Representation with Members {
86-
import reflect.{given, _}
86+
import reflect.{given _, _}
8787

8888
override val (name, path) = extractPackageNameAndPath(internal.pid.show)
8989
override val members = internal.stats.map(convertToRepresentation(reflect)(_, Some(this)))
@@ -93,7 +93,7 @@ object representations extends TastyExtractor {
9393
}
9494

9595
class ImportRepresentation(reflect: Reflection, internal: reflect.Import, override val parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) extends Representation {
96-
import reflect.{given, _}
96+
import reflect.{given _, _}
9797

9898
override val name = if (internal.selectors.size > 1){
9999
internal.selectors.map(_.toString).mkString("{", ", ", "}")
@@ -107,7 +107,7 @@ object representations extends TastyExtractor {
107107
}
108108

109109
class ClassRepresentation(reflect: Reflection, internal: reflect.ClassDef, override val parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) extends Representation with Members with Parents with Modifiers with Companion with Constructors with TypeParams {
110-
import reflect.{given, _}
110+
import reflect.{given _, _}
111111

112112
override val path = extractPath(reflect)(internal.symbol)
113113
override val parents = extractParents(reflect)(internal.parents)
@@ -143,7 +143,7 @@ object representations extends TastyExtractor {
143143
}
144144

145145
class DefRepresentation(reflect: Reflection, internal: reflect.DefDef, override val parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) extends Representation with Modifiers with TypeParams with MultipleParamList with ReturnValue {
146-
import reflect.{given, _}
146+
import reflect.{given _, _}
147147

148148
override val name = internal.name
149149
override val path = extractPath(reflect)(internal.symbol)
@@ -162,7 +162,7 @@ object representations extends TastyExtractor {
162162
}
163163

164164
class ValRepresentation(reflect: Reflection, internal: reflect.ValDef, override val parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) extends Representation with Modifiers with ReturnValue {
165-
import reflect.{given, _}
165+
import reflect.{given _, _}
166166

167167
override val name = internal.name
168168
override val path = extractPath(reflect)(internal.symbol)
@@ -175,7 +175,7 @@ object representations extends TastyExtractor {
175175
}
176176

177177
class TypeRepresentation(reflect: Reflection, internal: reflect.TypeDef, override val parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]) extends Representation with Modifiers with TypeParams {
178-
import reflect.{given, _}
178+
import reflect.{given _, _}
179179

180180
override val name = internal.name
181181
override val path = extractPath(reflect)(internal.symbol)
@@ -192,7 +192,7 @@ object representations extends TastyExtractor {
192192
}
193193

194194
def convertToRepresentation(reflect: Reflection)(tree: reflect.Tree, parentRepresentation: Option[Representation])(using mutablePackagesMap: scala.collection.mutable.HashMap[String, EmulatedPackageRepresentation]): Representation = {
195-
import reflect.{given, _}
195+
import reflect.{given _, _}
196196

197197
tree match {
198198
case t: reflect.PackageClause =>

0 commit comments

Comments
 (0)