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
}

0 commit comments

Comments
 (0)