Skip to content

Commit 2d57399

Browse files
committed
Fix extractor printing
1 parent 07b983f commit 2d57399

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

library/src/scala/tasty/util/ShowSourceCode.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,11 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
507507
printPattern(pattern)
508508

509509
case Pattern.Unapply(fun, implicits, patterns) =>
510-
printTree(fun)
510+
fun match {
511+
case Term.Select(extractor, "unapply" | "unapplySeq", _) => printTree(extractor)
512+
case Term.TypeApply(Term.Select(extractor, "unapply" | "unapplySeq", _), _) => printTree(extractor)
513+
case _ => throw new MatchError(fun.show)
514+
}
511515
this += "("
512516
printPatterns(patterns, ", ")
513517
this += ")"
@@ -516,7 +520,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
516520
printPatterns(trees, " | ")
517521

518522
case Pattern.TypeTest(tpt) =>
519-
this
523+
this += "_: "
524+
printTypeOrBoundsTree(tpt)
520525

521526
}
522527

@@ -542,8 +547,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
542547
printTypeTree(hi)
543548
case tpt @ SyntheticBounds() =>
544549
printTypeOrBound(tpt.tpe)
545-
case tpt@Type() =>
546-
printType(tpt)
550+
case tpt @ TypeTree() =>
551+
printTypeTree(tpt)
547552
}
548553

549554
def printTypeTree(tree: TypeTree): Buffer = tree match {

0 commit comments

Comments
 (0)