diff --git a/modules/core/src/main/scala/io/protoless/messages/decoders/CustomMappingDecoder.scala b/modules/core/src/main/scala/io/protoless/messages/decoders/CustomMappingDecoder.scala index d237535..e7eff55 100644 --- a/modules/core/src/main/scala/io/protoless/messages/decoders/CustomMappingDecoder.scala +++ b/modules/core/src/main/scala/io/protoless/messages/decoders/CustomMappingDecoder.scala @@ -17,7 +17,7 @@ import io.protoless.messages.Decoder */ @implicitNotFound("No CustomMappingDecoder found for type ${A} and ${L}.") @annotation.inductive -trait CustomMappingDecoder[A, L <: HList] extends Decoder[A] +class CustomMappingDecoder[A, L <: HList](val underlying: Decoder[A]) /** * Utilities for [[CustomMappingDecoder]] diff --git a/modules/core/src/main/scala/io/protoless/messages/decoders/IncrementalDecoder.scala b/modules/core/src/main/scala/io/protoless/messages/decoders/IncrementalDecoder.scala index 3e6ed22..2a2b9b7 100644 --- a/modules/core/src/main/scala/io/protoless/messages/decoders/IncrementalDecoder.scala +++ b/modules/core/src/main/scala/io/protoless/messages/decoders/IncrementalDecoder.scala @@ -14,7 +14,7 @@ import io.protoless.messages.Decoder */ @implicitNotFound("No IncrementalDecoder found for type ${A} and ${N}.") @annotation.inductive -trait IncrementalDecoder[A, N <: Nat] extends Decoder[A] +class IncrementalDecoder[A, N <: Nat](val underlying: Decoder[A]) /** * Utilities for [[IncrementalDecoder]] diff --git a/modules/core/src/main/scala/io/protoless/messages/encoders/CustomMappingEncoder.scala b/modules/core/src/main/scala/io/protoless/messages/encoders/CustomMappingEncoder.scala index b722167..791a4e2 100644 --- a/modules/core/src/main/scala/io/protoless/messages/encoders/CustomMappingEncoder.scala +++ b/modules/core/src/main/scala/io/protoless/messages/encoders/CustomMappingEncoder.scala @@ -8,7 +8,7 @@ import io.protoless.messages.Encoder @implicitNotFound("No CustomMappingEncoder found for type ${A} and ${L}.") @annotation.inductive -trait CustomMappingEncoder[A, L <: HList] extends Encoder[A] +class CustomMappingEncoder[A, L <: HList](val underlying: Encoder[A]) /** * Utilities for [[CustomMappingEncoder]] diff --git a/modules/core/src/main/scala/io/protoless/messages/encoders/IncrementalEncoder.scala b/modules/core/src/main/scala/io/protoless/messages/encoders/IncrementalEncoder.scala index 2722baa..f3a2c5c 100644 --- a/modules/core/src/main/scala/io/protoless/messages/encoders/IncrementalEncoder.scala +++ b/modules/core/src/main/scala/io/protoless/messages/encoders/IncrementalEncoder.scala @@ -8,7 +8,7 @@ import io.protoless.messages.Encoder @implicitNotFound("No IncrementalEncoder found for type ${A} and ${N}.") @annotation.inductive -trait IncrementalEncoder[A, N <: Nat] extends Encoder[A] +class IncrementalEncoder[A, N <: Nat](val underlying: Encoder[A]) /** * Utilities for [[IncrementalEncoder]] diff --git a/modules/generic/src/main/scala/io/protoless/generic/AutoEncoderDecoderInstances.scala b/modules/generic/src/main/scala/io/protoless/generic/AutoEncoderDecoderInstances.scala index 0c32bd6..e4f042b 100644 --- a/modules/generic/src/main/scala/io/protoless/generic/AutoEncoderDecoderInstances.scala +++ b/modules/generic/src/main/scala/io/protoless/generic/AutoEncoderDecoderInstances.scala @@ -7,14 +7,14 @@ import io.protoless.messages.Decoder.Result import io.protoless.messages.decoders.{AutoDecoder, IncrementalDecoder} import io.protoless.messages.encoders.{AutoEncoder, IncrementalEncoder} -trait AutoEncoderDecoderInstances extends IncrementalEncoderDecoderInstances { +trait AutoEncoderDecoderInstances { implicit def decodeAuto[A, R <: HList](implicit gen: Generic.Aux[A, R], decoder: IncrementalDecoder[R, Nat._1] ): AutoDecoder[A] = new AutoDecoder[A] { override def decode(input: CodedInputStream): Result[A] = { - decoder.decode(input) match { + decoder.underlying.decode(input) match { case Right(repr) => Right(gen.from(repr)) case l @ Left(_) => l.asInstanceOf[Result[A]] } @@ -26,7 +26,7 @@ trait AutoEncoderDecoderInstances extends IncrementalEncoderDecoderInstances { encoder: IncrementalEncoder[R, Nat._1] ): AutoEncoder[A] = new AutoEncoder[A] { override def encode(a: A, output: CodedOutputStream): Unit = { - encoder.encode(gen.to(a), output) + encoder.underlying.encode(gen.to(a), output) output.flush() } } diff --git a/modules/generic/src/main/scala/io/protoless/generic/CustomMappingEncoderDecoderInstances.scala b/modules/generic/src/main/scala/io/protoless/generic/CustomMappingEncoderDecoderInstances.scala index 878b4f0..59f5d18 100644 --- a/modules/generic/src/main/scala/io/protoless/generic/CustomMappingEncoderDecoderInstances.scala +++ b/modules/generic/src/main/scala/io/protoless/generic/CustomMappingEncoderDecoderInstances.scala @@ -5,95 +5,119 @@ import com.google.protobuf.{CodedInputStream, CodedOutputStream} import shapeless.{::, Generic, HList, HNil, Nat} import shapeless.ops.nat.ToInt +import io.protoless.messages.{Decoder, Encoder} import io.protoless.messages.decoders.CustomMappingDecoder import io.protoless.messages.encoders.CustomMappingEncoder import io.protoless.fields.{FieldEncoder, FieldDecoder} import io.protoless.messages.Decoder.Result -trait CustomMappingEncoderDecoderInstances extends IncrementalDecoderInstances { +trait CustomMappingEncoderDecoderInstances { - implicit val decodeCustomMappingHNil: CustomMappingDecoder[HNil, HNil] = new CustomMappingDecoder[HNil, HNil] { - override def decode(input: CodedInputStream): Result[HNil] = Right(HNil) - } + implicit val decodeCustomMappingHNil: CustomMappingDecoder[HNil, HNil] = + new CustomMappingDecoder[HNil, HNil]( + new Decoder[HNil] { + override def decode(input: CodedInputStream): Result[HNil] = Right(HNil) + } + ) // Decode mapping specified with Nat (Nat._1 :: Nat._3 :: HNil) implicit def decodeCustomMappingHList[H, T <: HList, L <: Nat, TN <: HList](implicit hDecoder: FieldDecoder[H], index: ToInt[L], tDecoder: CustomMappingDecoder[T, TN] - ): CustomMappingDecoder[H :: T, L :: TN] = new CustomMappingDecoder[H :: T, L :: TN] { - override def decode(input: CodedInputStream): Result[H :: T] = { - for { - h <- hDecoder.read(input, index()).right - t <- tDecoder.decode(input).right - } yield h :: t - } - } + ): CustomMappingDecoder[H :: T, L :: TN] = + new CustomMappingDecoder[H :: T, L :: TN]( + new Decoder[H :: T] { + override def decode(input: CodedInputStream): Result[H :: T] = { + for { + h <- hDecoder.read(input, index()).right + t <- tDecoder.underlying.decode(input).right + } yield h :: t + } + } + ) // Decode mapping specified with Literal types (-Yliteral-types) (1 :: 3 :: HNil) implicit def decodeCustomMappingHListLiteral[H, T <: HList, L <: Int, TN <: HList](implicit hDecoder: FieldDecoder[H], index: ValueOf[L], tDecoder: CustomMappingDecoder[T, TN] - ): CustomMappingDecoder[H :: T, L :: TN] = new CustomMappingDecoder[H :: T, L :: TN] { - override def decode(input: CodedInputStream): Result[H :: T] = { - for { - h <- hDecoder.read(input, valueOf[L]).right - t <- tDecoder.decode(input).right - } yield h :: t - } - } + ): CustomMappingDecoder[H :: T, L :: TN] = + new CustomMappingDecoder[H :: T, L :: TN]( + new Decoder[H :: T] { + override def decode(input: CodedInputStream): Result[H :: T] = { + for { + h <- hDecoder.read(input, valueOf[L]).right + t <- tDecoder.underlying.decode(input).right + } yield h :: t + } + } + ) implicit def decodeCustomMapping[A, L <: HList, R <: HList](implicit gen: Generic.Aux[A, R], decoder: CustomMappingDecoder[R, L] - ): CustomMappingDecoder[A, L] = new CustomMappingDecoder[A, L] { - override def decode(input: CodedInputStream): Result[A] = { - decoder.decode(input) match { - case Right(repr) => Right(gen.from(repr)) - case l @ Left(_) => l.asInstanceOf[Result[A]] + ): CustomMappingDecoder[A, L] = new CustomMappingDecoder[A, L]( + new Decoder[A] { + override def decode(input: CodedInputStream): Result[A] = { + decoder.underlying.decode(input) match { + case Right(repr) => Right(gen.from(repr)) + case l @ Left(_) => l.asInstanceOf[Result[A]] + } } } - } + ) - implicit val encodeCustomMappingHNil: CustomMappingEncoder[HNil, HNil] = new CustomMappingEncoder[HNil, HNil] { - override def encode(a: HNil, output: CodedOutputStream): Unit = {} - } + implicit val encodeCustomMappingHNil: CustomMappingEncoder[HNil, HNil] = + new CustomMappingEncoder[HNil, HNil]( + new Encoder[HNil] { + override def encode(a: HNil, output: CodedOutputStream): Unit = {} + } + ) // Encode mapping specified with Nat (Nat._1 :: Nat._3 :: HNil) implicit def encodeCustomMappingHList[H, T <: HList, L <: Nat, TN <: HList](implicit hEncoder: FieldEncoder[H], index: ToInt[L], tEncoder: CustomMappingEncoder[T, TN] - ): CustomMappingEncoder[H :: T, L :: TN] = new CustomMappingEncoder[H :: T, L :: TN] { - override def encode(a: H :: T, output: CodedOutputStream): Unit = { - val (h :: t) = a - hEncoder.write(index(), h, output) - tEncoder.encode(t, output) - } - } + ): CustomMappingEncoder[H :: T, L :: TN] = + new CustomMappingEncoder[H :: T, L :: TN]( + new Encoder[H :: T] { + override def encode(a: H :: T, output: CodedOutputStream): Unit = { + val (h :: t) = a + hEncoder.write(index(), h, output) + tEncoder.underlying.encode(t, output) + } + } + ) // Encode mapping specified with Literal (1 :: 3 :: HNil) implicit def encodeCustomMappingHListLiteral[H, T <: HList, L <: Int, TN <: HList](implicit hEncoder: FieldEncoder[H], index: ValueOf[L], tEncoder: CustomMappingEncoder[T, TN] - ): CustomMappingEncoder[H :: T, L :: TN] = new CustomMappingEncoder[H :: T, L :: TN] { - override def encode(a: H :: T, output: CodedOutputStream): Unit = { - val (h :: t) = a - hEncoder.write(valueOf[L], h, output) - tEncoder.encode(t, output) - } - } + ): CustomMappingEncoder[H :: T, L :: TN] = + new CustomMappingEncoder[H :: T, L :: TN]( + new Encoder[H :: T] { + override def encode(a: H :: T, output: CodedOutputStream): Unit = { + val (h :: t) = a + hEncoder.write(valueOf[L], h, output) + tEncoder.underlying.encode(t, output) + } + } + ) implicit def encodeCustomMapping[A, L <: HList, R <: HList](implicit gen: Generic.Aux[A, R], encoder: CustomMappingEncoder[R, L] - ): CustomMappingEncoder[A, L] = new CustomMappingEncoder[A, L] { - override def encode(a: A, output: CodedOutputStream): Unit = { - encoder.encode(gen.to(a), output) - output.flush() - } - } + ): CustomMappingEncoder[A, L] = + new CustomMappingEncoder[A, L]( + new Encoder[A] { + override def encode(a: A, output: CodedOutputStream): Unit = { + encoder.underlying.encode(gen.to(a), output) + output.flush() + } + } + ) } diff --git a/modules/generic/src/main/scala/io/protoless/generic/IncrementalDecoderInstances.scala b/modules/generic/src/main/scala/io/protoless/generic/IncrementalDecoderInstances.scala deleted file mode 100644 index 474a3d3..0000000 --- a/modules/generic/src/main/scala/io/protoless/generic/IncrementalDecoderInstances.scala +++ /dev/null @@ -1,5 +0,0 @@ -package io.protoless.generic - -trait IncrementalDecoderInstances { - -} diff --git a/modules/generic/src/main/scala/io/protoless/generic/IncrementalEncoderDecoderInstances.scala b/modules/generic/src/main/scala/io/protoless/generic/IncrementalEncoderDecoderInstances.scala new file mode 100644 index 0000000..b3d76d1 --- /dev/null +++ b/modules/generic/src/main/scala/io/protoless/generic/IncrementalEncoderDecoderInstances.scala @@ -0,0 +1,85 @@ +package io.protoless.generic + +import com.google.protobuf.CodedOutputStream +import com.google.protobuf.CodedInputStream +import shapeless.{::, Generic, HList, HNil, Nat, Succ} +import shapeless.ops.nat.ToInt + +import io.protoless.messages.{Decoder, Encoder} +import io.protoless.messages.encoders.IncrementalEncoder +import io.protoless.fields.FieldEncoder +import io.protoless.messages.Decoder.Result +import io.protoless.messages.decoders.IncrementalDecoder +import io.protoless.fields.FieldDecoder + +trait IncrementalEncoderDecoderInstances { + + implicit def encodeIncrementalHNil[N <: Nat]: IncrementalEncoder[HNil, N] = + new IncrementalEncoder[HNil, N]( + new Encoder[HNil] { + override def encode(a: HNil, output: CodedOutputStream): Unit = {} + } + ) + + implicit def encodeIncrementalHList[H, T <: HList, N <: Nat](implicit + hEncoder: FieldEncoder[H], + index: ToInt[N], + tEncoder: IncrementalEncoder[T, Succ[N]] + ): IncrementalEncoder[H :: T, N] = new IncrementalEncoder[H :: T, N]( + new Encoder[H :: T] { + override def encode(a: H :: T, output: CodedOutputStream): Unit = { + val (h :: t) = a + hEncoder.write(index(), h, output) + tEncoder.underlying.encode(t, output) + } + } + ) + + implicit def encodeIncremental[A, N <: Nat, R <: HList](implicit + gen: Generic.Aux[A, R], + encoder: IncrementalEncoder[R, N] + ): IncrementalEncoder[A, N] = new IncrementalEncoder[A, N]( + new Encoder[A] { + override def encode(a: A, output: CodedOutputStream): Unit = { + encoder.underlying.encode(gen.to(a), output) + output.flush() + } + } + ) + + implicit def decodeIncrementalHNil[N <: Nat]: IncrementalDecoder[HNil, N] = + new IncrementalDecoder[HNil, N]( + new Decoder[HNil] { + override def decode(input: CodedInputStream): Result[HNil] = Right(HNil) + } + ) + + implicit def decodeIncrementalHList[H, T <: HList, N <: Nat](implicit + hDecoder: FieldDecoder[H], + index: shapeless.ops.nat.ToInt[N], + tDecoder: IncrementalDecoder[T, Succ[N]] + ): IncrementalDecoder[H :: T, N] = new IncrementalDecoder[H :: T, N]( + new Decoder[H :: T] { + override def decode(input: CodedInputStream): Result[H :: T] = { + for { + h <- hDecoder.read(input, index()).right + t <- tDecoder.underlying.decode(input).right + } yield h :: t + } + } + ) + + implicit def decodeIncremental[A, N <: Nat, R <: HList](implicit + gen: Generic.Aux[A, R], + decoder: IncrementalDecoder[R, N] + ): IncrementalDecoder[A, N] = new IncrementalDecoder[A, N]( + new Decoder[A] { + override def decode(input: CodedInputStream): Result[A] = { + decoder.underlying.decode(input) match { + case Right(repr) => Right(gen.from(repr)) + case l @ Left(_) => l.asInstanceOf[Result[A]] + } + } + } + ) +} diff --git a/modules/generic/src/main/scala/io/protoless/generic/IncrementalEncoderInstances.scala b/modules/generic/src/main/scala/io/protoless/generic/IncrementalEncoderInstances.scala deleted file mode 100644 index bda6e9d..0000000 --- a/modules/generic/src/main/scala/io/protoless/generic/IncrementalEncoderInstances.scala +++ /dev/null @@ -1,71 +0,0 @@ -package io.protoless.generic - -import com.google.protobuf.CodedOutputStream -import com.google.protobuf.CodedInputStream -import shapeless.{::, Generic, HList, HNil, Nat, Succ} -import shapeless.ops.nat.ToInt - -import io.protoless.messages.encoders.IncrementalEncoder -import io.protoless.fields.FieldEncoder -import io.protoless.messages.Decoder.Result -import io.protoless.messages.decoders.IncrementalDecoder -import io.protoless.fields.FieldDecoder - -trait IncrementalEncoderDecoderInstances extends CustomMappingEncoderDecoderInstances { - - implicit def encodeIncrementalHNil[N <: Nat]: IncrementalEncoder[HNil, N] = new IncrementalEncoder[HNil, N] { - override def encode(a: HNil, output: CodedOutputStream): Unit = {} - } - - implicit def encodeIncrementalHList[H, T <: HList, N <: Nat](implicit - hEncoder: FieldEncoder[H], - index: ToInt[N], - tEncoder: IncrementalEncoder[T, Succ[N]] - ): IncrementalEncoder[H :: T, N] = new IncrementalEncoder[H :: T, N] { - override def encode(a: H :: T, output: CodedOutputStream): Unit = { - val (h :: t) = a - hEncoder.write(index(), h, output) - tEncoder.encode(t, output) - } - } - - implicit def encodeIncremental[A, N <: Nat, R <: HList](implicit - gen: Generic.Aux[A, R], - encoder: IncrementalEncoder[R, N] - ): IncrementalEncoder[A, N] = new IncrementalEncoder[A, N] { - override def encode(a: A, output: CodedOutputStream): Unit = { - encoder.encode(gen.to(a), output) - output.flush() - } - } - - implicit def decodeIncrementalHNil[N <: Nat]: IncrementalDecoder[HNil, N] = new IncrementalDecoder[HNil, N] { - override def decode(input: CodedInputStream): Result[HNil] = Right(HNil) - } - - implicit def decodeIncrementalHList[H, T <: HList, N <: Nat](implicit - hDecoder: FieldDecoder[H], - index: shapeless.ops.nat.ToInt[N], - tDecoder: IncrementalDecoder[T, Succ[N]] - ): IncrementalDecoder[H :: T, N] = new IncrementalDecoder[H :: T, N] { - override def decode(input: CodedInputStream): Result[H :: T] = { - for { - h <- hDecoder.read(input, index()).right - t <- tDecoder.decode(input).right - } yield h :: t - } - } - - implicit def decodeIncremental[A, N <: Nat, R <: HList](implicit - gen: Generic.Aux[A, R], - decoder: IncrementalDecoder[R, N] - ): IncrementalDecoder[A, N] = new IncrementalDecoder[A, N] { - override def decode(input: CodedInputStream): Result[A] = { - decoder.decode(input) match { - case Right(repr) => Right(gen.from(repr)) - case l @ Left(_) => l.asInstanceOf[Result[A]] - } - } - } - -} diff --git a/modules/generic/src/main/scala/io/protoless/generic/SemiAutoEncoderDecoderInstances.scala b/modules/generic/src/main/scala/io/protoless/generic/SemiAutoEncoderDecoderInstances.scala index f1bef07..66c858c 100644 --- a/modules/generic/src/main/scala/io/protoless/generic/SemiAutoEncoderDecoderInstances.scala +++ b/modules/generic/src/main/scala/io/protoless/generic/SemiAutoEncoderDecoderInstances.scala @@ -14,13 +14,13 @@ import io.protoless.messages.decoders.IncrementalDecoder private[protoless] class SemiAutoEncoder[A](val underlying: Encoder[A]) private[protoless] class SemiAutoDecoder[A](val underlying: Decoder[A]) -private[protoless] trait SemiAutoEncoderDecoderInstances extends IncrementalEncoderDecoderInstances { +private[protoless] trait SemiAutoEncoderDecoderInstances { implicit def encodeSemiAutoInstance[A](implicit encoder: IncrementalEncoder[A, Nat._1]): SemiAutoEncoder[A] = { - new SemiAutoEncoder[A](encoder) + new SemiAutoEncoder[A](encoder.underlying) } implicit def decodeSemiAutoInstance[A](implicit decoder: IncrementalDecoder[A, Nat._1]): SemiAutoDecoder[A] = { - new SemiAutoDecoder[A](decoder) + new SemiAutoDecoder[A](decoder.underlying) } } diff --git a/modules/generic/src/main/scala/io/protoless/generic/package.scala b/modules/generic/src/main/scala/io/protoless/generic/package.scala index 971eac6..34a60cb 100644 --- a/modules/generic/src/main/scala/io/protoless/generic/package.scala +++ b/modules/generic/src/main/scala/io/protoless/generic/package.scala @@ -16,13 +16,13 @@ package object generic { * You can still derive [[messages.decoders.CustomMappingDecoder]] and [[messages.encoders.CustomMappingEncoder]] * with `semiauto.deriveDecoder[A, L]` or by summoning a decoder with `CustomMappingDecoder[A, HList]` (idem for Encoders). */ - object auto extends AutoEncoderDecoderInstances + object auto extends AutoEncoderDecoderInstances with IncrementalEncoderDecoderInstances with CustomMappingEncoderDecoderInstances /** * Allows to manually derive [[Decoder]] and [[Encoder]], * either with `Automatic` strategy or `Custom Mapping` strategy. */ - object semiauto extends SemiAutoEncoderDecoderInstances { + object semiauto extends SemiAutoEncoderDecoderInstances with IncrementalEncoderDecoderInstances with CustomMappingEncoderDecoderInstances { /** * Derive an [[Decoder]] to decode a type `A` from a protobuf message, for which @@ -84,7 +84,7 @@ package object generic { * @tparam A Result of the decoder * @tparam L Mapping from `A` parameters to Protobuf field index */ - def deriveDecoder[A, L <: HList](implicit decoder: CustomMappingDecoder[A, L]): Decoder[A] = decoder + def deriveDecoder[A, L <: HList](implicit decoder: CustomMappingDecoder[A, L]): Decoder[A] = decoder.underlying /** * Derive an [[Encoder]] to encode a type `A` in a protobuf message, for which @@ -146,6 +146,6 @@ package object generic { * @tparam A Type to encode * @tparam L Mapping from `A` parameters to Protobuf field index */ - def deriveEncoder[A, L <: HList](implicit encoder: CustomMappingEncoder[A, L]): Encoder[A] = encoder + def deriveEncoder[A, L <: HList](implicit encoder: CustomMappingEncoder[A, L]): Encoder[A] = encoder.underlying } } diff --git a/modules/generic/src/test/scala/io/protoless/generic/messages/CustomMappingEncoderDecoderSuite.scala b/modules/generic/src/test/scala/io/protoless/generic/messages/CustomMappingEncoderDecoderSuite.scala index 9e96c6c..93f0b9c 100644 --- a/modules/generic/src/test/scala/io/protoless/generic/messages/CustomMappingEncoderDecoderSuite.scala +++ b/modules/generic/src/test/scala/io/protoless/generic/messages/CustomMappingEncoderDecoderSuite.scala @@ -9,11 +9,10 @@ import io.protoless.tests.ProtolessSuite import io.protoless.tests.instances.EqualityInstances import io.protoless.tests.samples._ import io.protoless.tests.samples.TestCaseNestedCustomMapping.InnerNestedCustomMapping -import io.protoless.generic.SemiAutoEncoderDecoderInstances -trait CustomMappingEncoderDecoderSuite extends ProtolessSuite with EqualityInstances with EncoderDecoderAssertions with SemiAutoEncoderDecoderInstances { +trait CustomMappingEncoderDecoderSuite extends ProtolessSuite with EqualityInstances with EncoderDecoderAssertions { - import io.protoless.generic.semiauto.{deriveEncoder, deriveDecoder} + import io.protoless.generic.semiauto._ // Fields number specified with Nat type IndexSimple = Nat._2 :: Nat._5 :: Nat._13 :: Nat._16 :: HNil diff --git a/modules/generic/src/test/scala/io/protoless/generic/messages/SemiAutoEncoderDecoderSuite.scala b/modules/generic/src/test/scala/io/protoless/generic/messages/SemiAutoEncoderDecoderSuite.scala index 61051d6..df46d9e 100644 --- a/modules/generic/src/test/scala/io/protoless/generic/messages/SemiAutoEncoderDecoderSuite.scala +++ b/modules/generic/src/test/scala/io/protoless/generic/messages/SemiAutoEncoderDecoderSuite.scala @@ -6,11 +6,10 @@ import io.protoless.messages.{Decoder, Encoder} import io.protoless.tests.ProtolessSuite import io.protoless.tests.instances.EqualityInstances import io.protoless.tests.samples._ -import io.protoless.generic.SemiAutoEncoderDecoderInstances -class SemiAutoEncoderDecoderSuite extends ProtolessSuite with EqualityInstances with EncoderDecoderAssertions with SemiAutoEncoderDecoderInstances { +class SemiAutoEncoderDecoderSuite extends ProtolessSuite with EqualityInstances with EncoderDecoderAssertions { - import io.protoless.generic.semiauto.{deriveEncoder, deriveDecoder} + import io.protoless.generic.semiauto._ implicit val decoderTestCaseAllFields: Decoder[TestCaseAllFields] = deriveDecoder[TestCaseAllFields] implicit val decoderTestCaseOptionalFields: Decoder[TestCaseOptionalFields] = deriveDecoder[TestCaseOptionalFields]