Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
nox213 committed Sep 26, 2024
1 parent 3d7d325 commit 23a7b55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ object Macros {
fail(tpe, _),
)

val myself: Option[Symbol] = sealedParents.find(_ == tpe.typeSymbol)
val sealedClassSymbol: Option[Symbol] = sealedParents.find(_ == tpe.typeSymbol)
val segments =
myself.toList.map(_.fullName.split('.')) ++
sealedClassSymbol.toList.map(_.fullName.split('.')) ++
sealedParents
.flatMap(_.asClass.knownDirectSubclasses)
.map(_.fullName.split('.'))
Expand Down
4 changes: 2 additions & 2 deletions upickle/implicits/src-3/upickle/implicits/macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,15 @@ def tagNameImpl0[T](transform: String => String)(using Quotes, Type[T]): Expr[St
inline def shortTagName[T]: String = ${ shortTagNameImpl[T] }
def shortTagNameImpl[T](using Quotes, Type[T]): Expr[String] =
import quotes.reflect._
val myself = if (TypeRepr.of[T].baseClasses.contains(TypeRepr.of[T].typeSymbol))
val sealedClassSymbol = if (TypeRepr.of[T].baseClasses.contains(TypeRepr.of[T].typeSymbol))
Some(TypeRepr.of[T].typeSymbol.fullName.split('.'))
else None
val segments = TypeRepr.of[T].baseClasses
.filter(_.flags.is(Flags.Sealed))
.flatMap(_.children)
.filter(_.flags.is(Flags.Case))
.map(_.fullName.split('.')) ++
myself.toList
sealedClassSymbol.toList

val identicalSegmentCount = Range(0, segments.map(_.length).max - 1)
.takeWhile(i => segments.map(_.lift(i)).distinct.size == 1)
Expand Down

0 comments on commit 23a7b55

Please sign in to comment.