Skip to content

Commit f9da4d6

Browse files
committed
Replace dead branches with match error that shows the extractors
1 parent 6551b53 commit f9da4d6

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

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

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
311311
case Term.Repeated(elems) =>
312312
printTrees(elems, ", ")
313313

314-
case Term.SelectOuter(_, _, _) =>
315-
???
314+
case _ =>
315+
throw new MatchError(tree.show)
316316

317317
}
318318

@@ -528,8 +528,13 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
528528
}
529529

530530
def printTypeOrBoundsTree(tpt: TypeOrBoundsTree): Buffer = tpt match {
531-
case TypeBoundsTree(lo, hi) => ???
532-
case tpt@Type() => printType(tpt)
531+
case TypeBoundsTree(lo, hi) =>
532+
this += " >: "
533+
printTypeTree(lo)
534+
this += " <: "
535+
printTypeTree(hi)
536+
case tpt@Type() =>
537+
printType(tpt)
533538
}
534539

535540
def printTypeTree(tree: TypeTree): Buffer = tree match {
@@ -582,6 +587,9 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
582587
this += "=> "
583588
printTypeTree(result)
584589

590+
case _ =>
591+
throw new MatchError(tree.show)
592+
585593
}
586594

587595
def printTypeOrBound(tpe: TypeOrBounds): Buffer = tpe match {
@@ -631,9 +639,6 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
631639
}
632640
this += name.stripSuffix("$")
633641

634-
case Type.SuperType(thistpe, supertpe) =>
635-
???
636-
637642
case Type.Refinement(parent, name, info) =>
638643
printType(parent)
639644
// TODO add refinements
@@ -661,26 +666,11 @@ class ShowSourceCode[T <: Tasty with Singleton](tasty0: T) extends Show[T](tasty
661666
this += " => "
662667
printType(tp)
663668

664-
case Type.ParamRef(binder, idx) =>
665-
???
666-
667669
case Type.ThisType(tp) =>
668670
printType(tp)
669671

670-
case Type.RecursiveThis(rec) =>
671-
???
672-
673-
case Type.RecursiveType(tp) =>
674-
???
675-
676-
case Type.MethodType(paramNames, paramTypes, resType) =>
677-
???
678-
679-
case Type.PolyType(paramNames, paramBounds, resType) =>
680-
???
681-
682-
case Type.TypeLambda(paramNames, paramBounds, resType) =>
683-
???
672+
case _ =>
673+
throw new MatchError(tpe.show)
684674
}
685675

686676
def printImportSelector(sel: ImportSelector): Buffer = sel match {

0 commit comments

Comments
 (0)