Skip to content

Commit

Permalink
Condition serialization autofix set/list mixups
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownJoe796 committed Oct 15, 2023
1 parent 83e0747 commit 24abb37
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ private fun <T: Comparable<T>> comparableOptions(inner: KSerializer<T>): List<My
MySealedClassSerializer.Option(Condition.LessThanOrEqual.serializer(inner)) { it is Condition.LessThanOrEqual },
)
private fun <T> listOptions(element: KSerializer<T>): List<MySealedClassSerializer.Option<Condition<List<T>>, *>> = commonOptions(ListSerializer(element)) + listOf(
MySealedClassSerializer.Option(Condition.ListAllElements.serializer(element), setOf("AllElements")) { it is Condition.ListAllElements },
MySealedClassSerializer.Option(Condition.ListAnyElements.serializer(element), setOf("AnyElements")) { it is Condition.ListAnyElements },
MySealedClassSerializer.Option(Condition.ListSizesEquals.serializer(element), setOf("SizesEquals")) { it is Condition.ListSizesEquals },
MySealedClassSerializer.Option(Condition.ListAllElements.serializer(element), setOf("SetAllElements", "AllElements")) { it is Condition.ListAllElements },
MySealedClassSerializer.Option(Condition.ListAnyElements.serializer(element), setOf("SetAnyElements", "AnyElements")) { it is Condition.ListAnyElements },
MySealedClassSerializer.Option(Condition.ListSizesEquals.serializer(element), setOf("SetSizesEquals", "SizesEquals")) { it is Condition.ListSizesEquals },
)
private fun <T> setOptions(element: KSerializer<T>): List<MySealedClassSerializer.Option<Condition<Set<T>>, *>> = commonOptions(SetSerializer(element)) + listOf(
MySealedClassSerializer.Option(Condition.SetAllElements.serializer(element)) { it is Condition.SetAllElements },
MySealedClassSerializer.Option(Condition.SetAnyElements.serializer(element)) { it is Condition.SetAnyElements },
MySealedClassSerializer.Option(Condition.SetSizesEquals.serializer(element)) { it is Condition.SetSizesEquals },
MySealedClassSerializer.Option(Condition.SetAllElements.serializer(element), setOf("ListAllElements", "AllElements")) { it is Condition.SetAllElements },
MySealedClassSerializer.Option(Condition.SetAnyElements.serializer(element), setOf("ListAnyElements", "AnyElements")) { it is Condition.SetAnyElements },
MySealedClassSerializer.Option(Condition.SetSizesEquals.serializer(element), setOf("ListSizesEquals", "SizesEquals")) { it is Condition.SetSizesEquals },
)
private fun <T> stringMapOptions(element: KSerializer<T>): List<MySealedClassSerializer.Option<Condition<Map<String, T>>, *>> = commonOptions(
MapSerializer(String.serializer(), element)
Expand Down

0 comments on commit 24abb37

Please sign in to comment.