Skip to content

Commit

Permalink
use new extractors for trees supporting clause interleaving
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Mar 19, 2023
1 parent d750ea5 commit 3ae87d4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/developers/patch.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The `replaceTree()` patch is a convenience operator for `removeTokens` and

```scala mdoc
doc.tree.collect {
case println @ Term.Apply(Name("println"), _) =>
case println @ Term.Apply.After_4_6_0(Name("println"), _) =>
Patch.replaceTree(println, "print(40 + 2)")
}.showDiff()
```
Expand Down Expand Up @@ -178,7 +178,7 @@ case class Println(position: Position) extends Diagnostic {
def message = "Use loggers instead of println"
}
doc.tree.collect {
case println @ Term.Apply(Term.Name("println"), _) =>
case println @ Term.Apply.After_4_6_0(Term.Name("println"), _) =>
Patch.lint(Println(println.pos))
}.showLints()
```
Expand Down
6 changes: 3 additions & 3 deletions docs/developers/semantic-tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ of those inferred `.apply` method calls.

```scala mdoc
doc.tree.traverse {
case Term.Apply(add @ q"add", List(q"2")) =>
case Term.Apply.After_4_6_0(add @ q"add", Term.ArgClause(List(q"2"), _)) =>
println("add(2)")
println("synthetic = " + add.synthetics)
println("symbol = " + add.synthetics.flatMap(_.symbol).structure)
println("structure = " + add.synthetics.structure)
case Term.ApplyType(option @ q"Option", List(t"Int")) =>
case Term.ApplyType.After_4_6_0(option @ q"Option", Term.ArgClause(List(t"Int"), _)) =>
println("Option[Int]")
println("synthetic = " + option.synthetics)
println("symbol = " + option.synthetics.flatMap(_.symbol).structure)
Expand Down Expand Up @@ -150,7 +150,7 @@ of infix operators.

```scala mdoc
doc.tree.traverse {
case concat @ Term.ApplyInfix(_, Term.Name("++"), _, _) =>
case concat @ Term.ApplyInfix.After_4_6_0(_, Term.Name("++"), _, _) =>
println(".syntheticOperators = " + concat.syntheticOperators)
println(".structure = " + concat.syntheticOperators.structure)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/symbol-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ node.

```scala mdoc
doc.tree.collect {
case apply @ Term.Apply(println @ Term.Name("println"), _) =>
case apply @ Term.Apply.After_4_6_0(println @ Term.Name("println"), _) =>
(apply.syntax, println.symbol)
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/symbol-matcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pattern.

```scala mdoc
doc.tree.traverse {
case function @ Term.Apply(successObject(_), List(argument)) =>
case function @ Term.Apply.After_4_6_0(successObject(_), List(argument)) =>
println(function.pos.formatMessage("info",
s"Argument of Success is $argument"))
}
Expand Down

0 comments on commit 3ae87d4

Please sign in to comment.