Skip to content

Commit 635061f

Browse files
Merge pull request #6228 from dotty-staging/rename-tasty-reflect-show-extractors
Rename TASTy reflect show to showExtractors
2 parents 449008e + 7933275 commit 635061f

File tree

19 files changed

+61
-61
lines changed

19 files changed

+61
-61
lines changed

library/src/scala/tasty/reflect/Printers.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,47 +24,47 @@ trait Printers
2424
/** Adds `show` as an extension method of a `Tree` */
2525
implicit class TreeShowDeco(tree: Tree) {
2626
/** Shows the tree as extractors */
27-
def show(implicit ctx: Context): String = new ExtractorsPrinter().showTree(tree)
27+
def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showTree(tree)
2828
/** Shows the tree as source code */
2929
def showCode(implicit ctx: Context): String = new SourceCodePrinter().showTree(tree)
3030
}
3131

3232
/** Adds `show` as an extension method of a `TypeOrBounds` */
3333
implicit class TypeOrBoundsShowDeco(tpe: TypeOrBounds) {
3434
/** Shows the tree as extractors */
35-
def show(implicit ctx: Context): String = new ExtractorsPrinter().showTypeOrBounds(tpe)
35+
def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showTypeOrBounds(tpe)
3636
/** Shows the tree as source code */
3737
def showCode(implicit ctx: Context): String = new SourceCodePrinter().showTypeOrBounds(tpe)
3838
}
3939

4040
/** Adds `show` as an extension method of a `Pattern` */
4141
implicit class PatternShowDeco(pattern: Pattern) {
4242
/** Shows the tree as extractors */
43-
def show(implicit ctx: Context): String = new ExtractorsPrinter().showPattern(pattern)
43+
def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showPattern(pattern)
4444
/** Shows the tree as source code */
4545
def showCode(implicit ctx: Context): String = new SourceCodePrinter().showPattern(pattern)
4646
}
4747

4848
/** Adds `show` as an extension method of a `Constant` */
4949
implicit class ConstantShowDeco(const: Constant) {
5050
/** Shows the tree as extractors */
51-
def show(implicit ctx: Context): String = new ExtractorsPrinter().showConstant(const)
51+
def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showConstant(const)
5252
/** Shows the tree as source code */
5353
def showCode(implicit ctx: Context): String = new SourceCodePrinter().showConstant(const)
5454
}
5555

5656
/** Adds `show` as an extension method of a `Symbol` */
5757
implicit class SymbolShowDeco(symbol: Symbol) {
5858
/** Shows the tree as extractors */
59-
def show(implicit ctx: Context): String = new ExtractorsPrinter().showSymbol(symbol)
59+
def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showSymbol(symbol)
6060
/** Shows the tree as source code */
6161
def showCode(implicit ctx: Context): String = new SourceCodePrinter().showSymbol(symbol)
6262
}
6363

6464
/** Adds `show` as an extension method of a `Flags` */
6565
implicit class FlagsShowDeco(flags: Flags) {
6666
/** Shows the tree as extractors */
67-
def show(implicit ctx: Context): String = new ExtractorsPrinter().showFlags(flags)
67+
def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showFlags(flags)
6868
/** Shows the tree as source code */
6969
def showCode(implicit ctx: Context): String = new SourceCodePrinter().showFlags(flags)
7070
}
@@ -598,7 +598,7 @@ trait Printers
598598
case IsTerm(Select(IsNew(newTree), _)) =>
599599
printType(newTree.tpe)(Some(cdef.symbol))
600600
case IsTerm(parent) =>
601-
throw new MatchError(parent.show)
601+
throw new MatchError(parent.showExtractors)
602602
}
603603

604604
def printSeparated(list: List[Tree /* Term | TypeTree */]): Unit = list match {
@@ -937,7 +937,7 @@ trait Printers
937937
printTypeTree(tpt)
938938

939939
case _ =>
940-
throw new MatchError(tree.show)
940+
throw new MatchError(tree.showExtractors)
941941

942942
}
943943

@@ -1320,7 +1320,7 @@ trait Printers
13201320
case Ident("unapply" | "unapplySeq") =>
13211321
this += fun.symbol.owner.fullName.stripSuffix("$")
13221322
case _ =>
1323-
throw new MatchError(fun.show)
1323+
throw new MatchError(fun.showExtractors)
13241324
}
13251325
inParens(printPatterns(patterns, ", "))
13261326

@@ -1332,7 +1332,7 @@ trait Printers
13321332
printTypeOrBoundsTree(tpt)
13331333

13341334
case _ =>
1335-
throw new MatchError(pattern.show)
1335+
throw new MatchError(pattern.showExtractors)
13361336

13371337
}
13381338

@@ -1457,7 +1457,7 @@ trait Printers
14571457
}
14581458

14591459
case _ =>
1460-
throw new MatchError(tree.show)
1460+
throw new MatchError(tree.showExtractors)
14611461

14621462
}
14631463

@@ -1612,7 +1612,7 @@ trait Printers
16121612
this += highlightTypeDef("this", color)
16131613

16141614
case _ =>
1615-
throw new MatchError(tpe.show)
1615+
throw new MatchError(tpe.showExtractors)
16161616
}
16171617

16181618
def printImportSelector(sel: ImportSelector): Buffer = sel match {
@@ -1647,7 +1647,7 @@ trait Printers
16471647
case Type.TypeRef("forceInline", Types.ScalaPackage()) => false
16481648
case _ => true
16491649
}
1650-
case x => throw new MatchError(x.show)
1650+
case x => throw new MatchError(x.showExtractors)
16511651
}
16521652
printAnnotations(annots)
16531653
if (annots.nonEmpty) this += " "

tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ object Foo {
1010
def inspectBodyImpl(x: Expr[Int])(implicit reflect: Reflection): Expr[String] = {
1111
import reflect._
1212
def definitionString(tree: Tree): Expr[String] = tree.symbol match {
13-
case IsDefDefSymbol(sym) => sym.tree.show
14-
case IsValDefSymbol(sym) => sym.tree.show
15-
case IsBindSymbol(sym) => sym.tree.show
13+
case IsDefDefSymbol(sym) => sym.tree.showExtractors
14+
case IsValDefSymbol(sym) => sym.tree.showExtractors
15+
case IsBindSymbol(sym) => sym.tree.showExtractors
1616
}
1717
x.unseal match {
1818
case Inlined(None, Nil, arg) => definitionString(arg)

tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ object Foo {
1010
def inspectBodyImpl(x: Expr[Int])(implicit reflect: Reflection): Expr[String] = {
1111
import reflect._
1212
def definitionString(tree: Tree): Expr[String] = tree.symbol match {
13-
case IsDefDefSymbol(sym) => sym.tree.show
14-
case IsValDefSymbol(sym) => sym.tree.show
15-
case IsBindSymbol(sym) => sym.tree.show
13+
case IsDefDefSymbol(sym) => sym.tree.showExtractors
14+
case IsValDefSymbol(sym) => sym.tree.showExtractors
15+
case IsBindSymbol(sym) => sym.tree.showExtractors
1616
}
1717
x.unseal match {
1818
case Inlined(None, Nil, arg) => definitionString(arg)

tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ object Macros {
2828
case IsDefinition(tree @ DefDef(name, _, _, _, _)) =>
2929
buff.append(name)
3030
buff.append("\n")
31-
buff.append(tree.symbol.owner.treeOpt.get.show)
31+
buff.append(tree.symbol.owner.treeOpt.get.showExtractors)
3232
buff.append("\n\n")
3333
case IsDefinition(tree @ ValDef(name, _, _)) =>
3434
buff.append(name)
3535
buff.append("\n")
36-
buff.append(tree.symbol.owner.treeOpt.get.show)
36+
buff.append(tree.symbol.owner.treeOpt.get.showExtractors)
3737
buff.append("\n\n")
3838
case _ =>
3939
}

tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ object Foo {
1111
import reflect._
1212

1313
def definitionString(tree: Tree): Expr[String] = tree.symbol match {
14-
case IsClassDefSymbol(sym) => sym.tree.show.toExpr
15-
case IsDefDefSymbol(sym) => sym.tree.show.toExpr
16-
case IsValDefSymbol(sym) => sym.tree.show.toExpr
14+
case IsClassDefSymbol(sym) => sym.tree.showExtractors.toExpr
15+
case IsDefDefSymbol(sym) => sym.tree.showExtractors.toExpr
16+
case IsValDefSymbol(sym) => sym.tree.showExtractors.toExpr
1717
case _ => '{"NO DEFINTION"}
1818
}
1919

tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ object Foo {
1111
import reflect._
1212

1313
def definitionString(tree: Tree): Expr[String] = tree.symbol match {
14-
case IsClassDefSymbol(sym) => sym.tree.show.toExpr
15-
case IsDefDefSymbol(sym) => sym.tree.show.toExpr
16-
case IsValDefSymbol(sym) => sym.tree.show.toExpr
14+
case IsClassDefSymbol(sym) => sym.tree.showExtractors.toExpr
15+
case IsDefDefSymbol(sym) => sym.tree.showExtractors.toExpr
16+
case IsValDefSymbol(sym) => sym.tree.showExtractors.toExpr
1717
case _ => '{"NO DEFINTION"}
1818
}
1919

tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
152152
case Typed(expr, _) => log("<interpretTyped>", tree)(eval(expr))
153153
case Repeated(elems, _) => log("<interpretRepeated>", tree)(interpretRepeated(elems.map(elem => eval(elem))))
154154

155-
case _ => throw new MatchError(tree.show)
155+
case _ => throw new MatchError(tree.showExtractors)
156156
}
157157
}
158158

@@ -161,7 +161,7 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) {
161161
println(
162162
s"""#> $tag:
163163
|${tree.showCode}
164-
|${tree.show}
164+
|${tree.showExtractors}
165165
|
166166
|""".stripMargin)
167167
thunk

tests/run-with-compiler/tasty-consumer/Test.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DBConsumer extends TastyConsumer {
1515

1616
override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = tree match {
1717
case IsDefinition(tree) =>
18-
println(tree.show)
18+
println(tree.showExtractors)
1919
super.traverseTree(tree)
2020
case tree =>
2121
super.traverseTree(tree)

tests/run/f-interpolation-1/FQuote_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object FQuote {
4040
values.forall(isStringConstant) =>
4141
values.collect { case Literal(Constant.String(value)) => value }
4242
case tree =>
43-
throw new QuoteError(s"String literal expected, but ${tree.show} found")
43+
throw new QuoteError(s"String literal expected, but ${tree.showExtractors} found")
4444
}
4545

4646
// [a0, ...]: Any*

tests/run/i5119/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ object Macro {
99
implicit inline def XmlQuote(sc: => StringContext): StringContextOps = new StringContextOps(sc)
1010
def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(implicit reflect: Reflection): Expr[String] = {
1111
import reflect._
12-
(sc.unseal.underlyingArgument.show + "\n" + args.unseal.underlyingArgument.show)
12+
(sc.unseal.underlyingArgument.showExtractors + "\n" + args.unseal.underlyingArgument.showExtractors)
1313
}
1414
}

tests/run/i5119b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object Macro {
99

1010
def impl(arg1: Expr[Any], arg2: Expr[Any])(implicit reflect: Reflection): Expr[String] = {
1111
import reflect._
12-
(arg1.unseal.underlyingArgument.show + "\n" + arg2.unseal.underlyingArgument.show)
12+
(arg1.unseal.underlyingArgument.showExtractors + "\n" + arg2.unseal.underlyingArgument.showExtractors)
1313
}
1414

1515
}

tests/run/tasty-argument-tree-1/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ object Macros {
1212
val tree = x.unseal
1313
'{
1414
println()
15-
println("tree: " + ${tree.show})
16-
println("tree deref. vals: " + ${tree.underlying.show})
15+
println("tree: " + ${tree.showExtractors})
16+
println("tree deref. vals: " + ${tree.underlying.showExtractors})
1717
}
1818
}
1919
}

tests/run/tasty-definitions-1/quoted_1.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,21 @@ object Macros {
7777
printout(definitions.ScalaPrimitiveValueClasses.map(_.name).toString)
7878
printout(definitions.ScalaNumericValueClasses.map(_.name).toString)
7979

80-
printout(definitions.UnitType.show)
81-
printout(definitions.ByteType.show)
82-
printout(definitions.CharType.show)
83-
printout(definitions.IntType.show)
84-
printout(definitions.LongType.show)
85-
printout(definitions.FloatType.show)
86-
printout(definitions.DoubleType.show)
87-
printout(definitions.BooleanType.show)
88-
printout(definitions.AnyType.show)
89-
printout(definitions.AnyValType.show)
90-
printout(definitions.AnyRefType.show)
91-
printout(definitions.ObjectType.show)
92-
printout(definitions.NothingType.show)
93-
printout(definitions.NullType.show)
94-
printout(definitions.StringType.show)
80+
printout(definitions.UnitType.showExtractors)
81+
printout(definitions.ByteType.showExtractors)
82+
printout(definitions.CharType.showExtractors)
83+
printout(definitions.IntType.showExtractors)
84+
printout(definitions.LongType.showExtractors)
85+
printout(definitions.FloatType.showExtractors)
86+
printout(definitions.DoubleType.showExtractors)
87+
printout(definitions.BooleanType.showExtractors)
88+
printout(definitions.AnyType.showExtractors)
89+
printout(definitions.AnyValType.showExtractors)
90+
printout(definitions.AnyRefType.showExtractors)
91+
printout(definitions.ObjectType.showExtractors)
92+
printout(definitions.NothingType.showExtractors)
93+
printout(definitions.NullType.showExtractors)
94+
printout(definitions.StringType.showExtractors)
9595

9696

9797
'{println(${buff.result().mkString("\n")})}

tests/run/tasty-extractors-1/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ object Macros {
1212
import reflect._
1313

1414
val tree = x.unseal
15-
val treeStr = tree.show
16-
val treeTpeStr = tree.tpe.show
15+
val treeStr = tree.showExtractors
16+
val treeTpeStr = tree.tpe.showExtractors
1717

1818
'{
1919
println(${treeStr})

tests/run/tasty-extractors-2/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ object Macros {
1313

1414
val tree = x.unseal
1515

16-
val treeStr = tree.show
17-
val treeTpeStr = tree.tpe.show
16+
val treeStr = tree.showExtractors
17+
val treeTpeStr = tree.tpe.showExtractors
1818

1919
'{
2020
println(${treeStr})

tests/run/tasty-extractors-3/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ object Macros {
1515
val traverser = new TreeTraverser {
1616
override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = tree match {
1717
case IsTypeBoundsTree(tree) =>
18-
buff.append(tree.tpe.show)
18+
buff.append(tree.tpe.showExtractors)
1919
buff.append("\n\n")
2020
traverseTreeChildren(tree)
2121
case IsTypeTree(tree) =>
22-
buff.append(tree.tpe.show)
22+
buff.append(tree.tpe.showExtractors)
2323
buff.append("\n\n")
2424
traverseTreeChildren(tree)
2525
case _ =>

tests/run/tasty-extractors-types/quoted_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ object Macros {
1212

1313
val tree = x.unseal
1414
'{
15-
println(${tree.show})
16-
println(${tree.tpe.show})
15+
println(${tree.showExtractors})
16+
println(${tree.tpe.showExtractors})
1717
println()
1818
}
1919
}

tests/run/xml-interpolation-1/XmlQuote_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object XmlQuote {
2222

2323
// for debugging purpose
2424
def pp(tree: Tree): Unit = {
25-
println(tree.show)
25+
println(tree.showExtractors)
2626
println(tree.showCode)
2727
}
2828

@@ -53,7 +53,7 @@ object XmlQuote {
5353
values.forall(isStringConstant) =>
5454
values.collect { case Literal(Constant.String(value)) => value }
5555
case tree =>
56-
abort(s"String literal expected, but ${tree.show} found")
56+
abort(s"String literal expected, but ${tree.showExtractors} found")
5757
}
5858

5959
// [a0, ...]: Any*

tests/run/xml-interpolation-2/XmlQuote_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object XmlQuote {
2121

2222
// for debugging purpose
2323
def pp(tree: Tree): Unit = {
24-
println(tree.show)
24+
println(tree.showExtractors)
2525
println(tree.showCode)
2626
}
2727

0 commit comments

Comments
 (0)