Skip to content

Summoning Mirror for ADT defined in trait #13332

Closed
@TimWSpence

Description

@TimWSpence

Compiler version

scala-3.1.0-RC1-bin-20210817-f27c250-NIGHTLY (I tried to use the most recent I could find as I thought there's a chance that #11686 might have fixed this as it's in a similar area. Not entirely sure if that made it into this nightly or not)

Minimized code

import scala.deriving.Mirror

class Scope extends IListDefn {

  type Of = Mirror { type MirroredType[X] = IList[X]; type MirroredMonoType = IList[Any] ; type MirroredElemTypes[_] <: Tuple }

  val M = summon[Of]
}


trait IListDefn {
  sealed trait IList[A]
  case class INil[A]() extends IList[A]
  case class ICons[A](h: A, t: IList[A]) extends IList[A]
}

Output

[error] -- Error: /private/tmp/scala/Minimization.scala:7:20 ---------------------------
[error] 7 |  val M = summon[Of]
[error]   |                    ^
[error]   |no implicit argument of type Scope.this.Of was found for parameter x of method summon in object Predef
[error] one error found

Expectation

Compilation should succeed (and does if you move the IList definition out of the trait and up to top-level)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions