Open
Description
Compiler version
3.3.5, 3.6.4, and latest nightly 3.7.1-RC1-bin-20250325-701fa8a-NIGHTLY
Minimized code
import scala.deriving.Mirror
sealed trait DefinesType {
sealed trait Type
case object Foo extends Type
}
object ExtendsType1 extends DefinesType {
case object Bar extends Type
}
object ExtendsType2 extends DefinesType {
case object Baz extends Type
}
summon[Mirror.Of[ExtendsType1.Type]]
Output
scala.deriving.Mirror.Sum {
type MirroredMonoType = ExtendsType1.Type
type MirroredType = ExtendsType1.Type
type MirroredLabel = "Type"
type MirroredElemTypes = (ExtendsType1.Foo.type, ExtendsType1.Bar.type, ExtendsType2.Baz.type)
type MirroredElemLabels = ("Foo", "Bar", "Baz")
}
Expectation
The Mirror
for ExtendsType1.Type
should not contain a reference to ExtendsType2.Baz
since the Type
that it extends (ExtendsType2.Type
) is different. The typer believes this:
scala> ExtendsType2.Baz: ExtendsType1.Type
-- [E007] Type Mismatch Error: -------------------------------------------------
1 |ExtendsType2.Baz: ExtendsType1.Type
|^^^^^^^^^^^^^^^^
|Found: ExtendsType2.Baz.type
|Required: ExtendsType1.Type