Skip to content

Commit 120c033

Browse files
committed
Remove useless extractors
1 parent fea0dd6 commit 120c033

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

library/src/scala/tasty/reflect/SourceCodePrinter.scala

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
150150
}
151151

152152
val parents1 = parents.filter {
153-
case Apply(Select(New(tpt), _), _) => !Types.JavaLangObject.unapply(tpt.tpe)
153+
case Apply(Select(New(tpt), _), _) => tpt.tpe.typeSymbol != ctx.requiredClass("java.lang.Object")
154154
case TypeSelect(Select(Ident("_root_"), "scala"), "Product") => false
155155
case TypeSelect(Select(Ident("_root_"), "scala"), "Serializable") => false
156156
case _ => true
@@ -1014,7 +1014,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
10141014
case Annotated(tpt, annot) =>
10151015
val Annotation(ref, args) = annot
10161016
ref.tpe match {
1017-
case Types.RepeatedAnnotation() =>
1017+
case tpe: TypeRef if tpe.typeSymbol == ctx.requiredClass("scala.annotation.internal.Repeated") =>
10181018
val Types.Sequence(tp) = tpt.tpe
10191019
printType(tp)
10201020
this += highlightTypeDef("*")
@@ -1434,27 +1434,13 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig
14341434
// TODO Provide some of these in scala.tasty.Reflection.scala and implement them using checks on symbols for performance
14351435
private object Types {
14361436

1437-
object JavaLangObject {
1438-
def unapply(tpe: Type)(given ctx: Context): Boolean = tpe match {
1439-
case TypeRef(prefix: TermRef, "Object") => prefix.typeSymbol == ctx.requiredPackage("java.lang")
1440-
case _ => false
1441-
}
1442-
}
1443-
14441437
object Sequence {
14451438
def unapply(tpe: Type)(given ctx: Context): Option[Type] = tpe match {
14461439
case AppliedType(seq, (tp: Type) :: Nil) if seq.typeSymbol == ctx.requiredClass("scala.collection.Seq") => Some(tp)
14471440
case _ => None
14481441
}
14491442
}
14501443

1451-
object RepeatedAnnotation {
1452-
def unapply(tpe: Type)(given ctx: Context): Boolean = tpe match {
1453-
case tpe: TypeRef => tpe.typeSymbol == ctx.requiredClass("scala.annotation.internal.Repeated")
1454-
case _ => false
1455-
}
1456-
}
1457-
14581444
object Repeated {
14591445
def unapply(tpe: Type)(given ctx: Context): Option[Type] = tpe match {
14601446
case AppliedType(TypeRef(ScalaPackage(), "<repeated>"), (tp: Type) :: Nil) => Some(tp)

0 commit comments

Comments
 (0)