Skip to content

Case class with nested inner class not resolving properly. #34

@akara

Description

@akara

Simple example:

object TestMessages {
  case class InnerMessage(id: Int, name: String)
}

import TestMessages._

case class NestedInnerMessage(id: Int, inner: InnerMessage)

Writing this message works correctly:

    "write a message with inner nested type to Protobuf" in {
      import TestMessages._
      val nested = NestedInnerMessage(0, InnerMessage(1, "Hi"))
      nested.toPB shouldBe Array[Byte](8, 0, 18, 6, 8, 1, 18, 2, 72, 105)
    }

However, reading gives a compiler error:

    "read a message with inner nested type to Protobuf" in {
      import TestMessages._
      val bytes = Array[Byte](8, 0, 18, 6, 8, 1, 18, 2, 72, 105)
      bytes.pbTo[NestedInnerMessage] shouldBe NestedInnerMessage(0, InnerMessage(1, "Hi"))
    }
error: could not find implicit value for parameter reader: pbdirect.PBParser[pbdirect.NestedInnerMessage]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions