Closed
Description
Compiler version
3.4.2-RC1
Minimized code
$sbt testCompilation tests/pos/shared-classname.scala
. Does not fail with scalac tests/pos/shared-classname.scala
.
(shortened version of not-looping-implicit.scala with the anonymous classes given the same name).
import scala.deriving.Mirror
import scala.compiletime._
trait Schema[T]
object Schema {
inline given derived[A]: Schema[A] =
inline summonInline[Mirror.Of[A]] match {
case m: Mirror.SumOf[A] =>
summonInline[Schema[m.MirroredElemTypes]]
class InlinedSchema extends Schema[A] {}
new InlinedSchema
case m: Mirror.ProductOf[A] =>
class InlinedSchema extends Schema[A] {}
new InlinedSchema
}
}
sealed trait InputValue
object InputValue {
case class T() extends InputValue
}
@main def Test:Schema[InputValue] =
Schema.derived
Output (click arrow to expand)
completed (0/1, 0 failed, 0s)java.lang.AssertionError: assertion failed: class defined twice class Schema$_$InlinedSchema 7130 6099
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.transform.TreeChecker.testDuplicate(TreeChecker.scala:55)
...