From 902bd21054bd3fe3bc97bfddc4c016e73800377c Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 18 Dec 2020 10:25:41 +0100 Subject: [PATCH 1/2] Update `showExtractors` to `Printer.TreeStructure` --- docs/docs/reference/metaprogramming/tasty-reflect.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/docs/reference/metaprogramming/tasty-reflect.md b/docs/docs/reference/metaprogramming/tasty-reflect.md index bdf3fe6a52ec..91dfa991aac1 100644 --- a/docs/docs/reference/metaprogramming/tasty-reflect.md +++ b/docs/docs/reference/metaprogramming/tasty-reflect.md @@ -58,8 +58,14 @@ def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = { } ``` -To easily know which extractors are needed, the `showExtractors` method on a -`quotes.reflect.Term` returns the string representation of the extractors. +To easily know which extractors are needed using the `Printer.TreeStructure.show` which returns the string representation the structure of the tree. Other printers can also be found in the `Printer` module. + +```scala +xTree.show(using Printer.TreeStructure) +// or +Printer.TreeStructure.show(xTree) +``` + The methods `quotes.reflect.Term.{asExpr, asExprOf}` provide a way to go back to a `quoted.Expr`. Note that `asExpr` returns a `Expr[Any]`. From b2d516351a97a2c1c3ce61320519dceb7658189c Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 18 Dec 2020 11:36:01 +0100 Subject: [PATCH 2/2] Update docs/docs/reference/metaprogramming/tasty-reflect.md Co-authored-by: Jamie Thompson --- docs/docs/reference/metaprogramming/tasty-reflect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/reference/metaprogramming/tasty-reflect.md b/docs/docs/reference/metaprogramming/tasty-reflect.md index 91dfa991aac1..94b4d83ae299 100644 --- a/docs/docs/reference/metaprogramming/tasty-reflect.md +++ b/docs/docs/reference/metaprogramming/tasty-reflect.md @@ -58,7 +58,7 @@ def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = { } ``` -To easily know which extractors are needed using the `Printer.TreeStructure.show` which returns the string representation the structure of the tree. Other printers can also be found in the `Printer` module. +We can easily know which extractors are needed using `Printer.TreeStructure.show`, which returns the string representation the structure of the tree. Other printers can also be found in the `Printer` module. ```scala xTree.show(using Printer.TreeStructure)