Skip to content

Mirror.Sum not synthesised for base class without companion #10997

Closed
@jtjeferreira

Description

@jtjeferreira

Minimized code

class Test {
  sealed trait Role
  case object Admin extends Role
  case class Contributor(organization: String) extends Role
  
  println(summon[Mirror.Of[Role]])
}

Output

// no implicit argument of type deriving.Mirror.Of[Test.this.Role] was found for parameter x of method summon in object Predef

Expectation

It should be able to derive the mirror as if it was inside the companion object.

object Test {
  sealed trait Role
  case object Admin extends Role
  case class Contributor(organization: String) extends Role
  
  println(summon[Mirror.Of[Role]])
}

I found this while I was port play-json to dotty (https://github.com/playframework/play-json/pull/555/files).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions