Skip to content

Commit d52eda4

Browse files
committed
Code clean up
1 parent 44d308b commit d52eda4

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

jsoniter-scala-macros/shared/src/main/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMaker.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,6 @@ object JsonCodecMaker {
15401540
else if (tpe.termSymbol.flags.is(Flags.Enum)) {
15411541
tpe match
15421542
case TermRef(_, name) => name
1543-
case TypeRef(_, name) => name
1544-
case AppliedType(TermRef(_, name), _) => name
1545-
case AppliedType(TypeRef(_, name), _) => name
15461543
case _ => fail(s"Unsupported enum type: '${tpe.show}', tree=$tpe")
15471544
} else if (tpe.typeSymbol.flags.is(Flags.Module)) tpe.termSymbol.fullName
15481545
else tpe.typeSymbol.fullName

jsoniter-scala-macros/shared/src/test/scala-3/com/github/plokhotnyuk/jsoniter_scala/macros/JsonCodecMakerNewKeywordSpec.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ class JsonCodecMakerNewKeywordSpec extends VerifyingSpec {
114114
verifySerDeser(summon[JsonValueCodec[TestEnum]], TestEnum.Value2("VVV"), """{"hint":"Value2","str":"VVV"}""")
115115
}
116116
}
117-
"serialize and deserialize a complex generic types defined with `derives` keyword and a custom compile-time configurations" in {
117+
"serialize and deserialize a complex generic types for the recursive data structure defined with `derives` keyword" in {
118118
verifySerDeser(make[LinkedList[Int]](CodecMakerConfig.withAllowRecursiveTypes(true)),
119-
LinkedList.Node2[Int](2, LinkedList.Node[Int](1, LinkedList.End)),
120-
"""{"type":"Node2","value":2,"next":{"value":1,"next":{"type":"End"}}}""")
119+
LinkedList.Node(2, LinkedList.Node(1, LinkedList.End)),
120+
"""{"type":"Node","value":2,"next":{"type":"Node","value":1,"next":{"type":"End"}}}""")
121121
}
122122
"serialize and deserialize an generic ADT defined with bounded leaf classes using a custom codec" in {
123123
sealed trait TypeBase[T]
@@ -207,7 +207,6 @@ class JsonCodecMakerNewKeywordSpec extends VerifyingSpec {
207207

208208
inline given CodecMakerConfig = CodecMakerConfig.withAllowRecursiveTypes(true)
209209

210-
enum LinkedList[+T] derives ConfiguredJsonValueCodec: // Borrowed from https://github.com/com-lihaoyi/upickle/pull/607
210+
enum LinkedList[+T] derives ConfiguredJsonValueCodec:
211211
case End
212212
case Node(value: T, next: LinkedList[T])
213-
case Node2(value: T, next: Node[T])

0 commit comments

Comments
 (0)