Skip to content

More strange behavior with derivation mirrors #7050

Open
@anatoliykmetyuk

Description

@anatoliykmetyuk
import scala.deriving._

case class Foo(x: Int, y: String)

def weird = {
  val m = the[Mirror.ProductOf[Foo]]
  type R = m.MirroredElemTypes
  val mRes = the[Mirror.ProductOf[(Int, String)]]
  given mt as Mirror.ProductOf[R] = mRes
}

Says:

-- [E045] Cyclic Error: ../pg/Main.scala:10:11 ---------------------------------
10 |  type R = m.MirroredElemTypes
   |           ^
   |           Recursive value m needs type

longer explanation available when compiling with `-explain`
one error found
[error] Nonzero exit code returned from runner: 1
[error] (dotty-compiler / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 15 s, completed Aug 15, 2019 5:24:41 PM

To make it compile:

def weird = {
  val m = the[Mirror.ProductOf[Foo]]
  type R = m.MirroredElemTypes
  val mRes = the[Mirror.ProductOf[(Int, String)]]
  // given mt as Mirror.ProductOf[R] = mRes
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogNo work planned on this by the core team for the time being.itype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions