Skip to content

Commit d489b08

Browse files
committed
TastyReader: extends BLOCK, #SCL-23793 fixed
1 parent 81b8736 commit d489b08

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.jetbrains.plugins.scala.text.scala3
2+
3+
import org.jetbrains.plugins.scala.DependencyManagerBase.RichStr
4+
import org.jetbrains.plugins.scala.text.TextToTextTestBase
5+
6+
class JsoniterTest extends TextToTextTestBase(
7+
Seq(
8+
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.35.1"
9+
),
10+
Seq("com.github.plokhotnyuk.jsoniter_scala"), Set.empty, 22,
11+
Set.empty,
12+
withSources = true,
13+
Set(
14+
"com.github.plokhotnyuk.jsoniter_scala.macros.NameMapper" // Suitable method not found
15+
)
16+
)

scala/tasty-reader/src/TreePrinter.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,12 @@ class TreePrinter(privateMembers: Boolean = false, infixTypes: Boolean = false,
273273
val isInEnum = definition.exists(_.contains(ENUM))
274274
val isInCaseClass = !isInEnum && definition.exists(_.contains(CASE))
275275
def textOf(tpe: Node): String = textOfType(tpe, parens = 1)
276+
val blockChildren = children match {
277+
case Seq(Node3(BLOCK, _, children), _: _*) => children
278+
case _ => children
279+
}
276280
// TODO recursive textOf method, common syntactic sugar for FunctionN and TupleN
277-
val parents = children.collect { // TODO rely on name kind
281+
val parents = blockChildren.collect { // TODO rely on name kind
278282
case node if node.isTypeTree => textOf(node)
279283
case Node3(APPLY, _, Seq(Node3(SELECTin, _, Seq(Node3(NEW, _, Seq(tpe, _: _*)), _: _*)), _: _*)) => textOf(tpe)
280284
case Node3(APPLY, _, Seq(Node3(APPLY, _, Seq(Node3(SELECTin, _, Seq(Node3(NEW, _, Seq(tpe, _: _*)), _: _*)), _: _*)), _: _*)) => textOf(tpe)

0 commit comments

Comments
 (0)