Skip to content

Commit b7405bb

Browse files
authored
Merge pull request #10849 from dotty-staging/fix-show-extractors-doc
Update `showExtractors` to `Printer.TreeStructure`
2 parents 3926860 + b2d5163 commit b7405bb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = {
5858
}
5959
```
6060

61-
To easily know which extractors are needed, the `showExtractors` method on a
62-
`quotes.reflect.Term` returns the string representation of the extractors.
61+
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.
62+
63+
```scala
64+
xTree.show(using Printer.TreeStructure)
65+
// or
66+
Printer.TreeStructure.show(xTree)
67+
```
68+
6369

6470
The methods `quotes.reflect.Term.{asExpr, asExprOf}` provide a way to go back to a `quoted.Expr`.
6571
Note that `asExpr` returns a `Expr[Any]`.

0 commit comments

Comments
 (0)