Skip to content

Can't summon Mirror for a sealed trait containing another sealed trait #12308

Closed
@ghostdogpr

Description

@ghostdogpr

Compiler version

3.0.0-RC3

Minimized code

import scala.deriving.Mirror
import scala.compiletime._

sealed trait SomeTrait
object SomeTrait {
  case class B(a: Int) extends SomeTrait
  case class C(a: Int) extends SomeTrait
  sealed trait SomeOtherTrait extends SomeTrait
  case class D(a: Int) extends SomeOtherTrait
}

summonInline[Mirror.Of[SomeTrait]]

Output

cannot reduce summonFrom with
 patterns :  case given t @ _:deriving.Mirror.Of[SomeTrait]

Expectation

A mirror is summoned.

I am currently trying to cross-build a library with Scala 3 and rewriting the typeclass derivation logic. I ran into this issue when dealing with nested sealed traits. Is that intended? Is there any workaround?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions