Skip to content

"children of trait were already queried before class was discovered" due to match type used #17132

@Verntrax

Description

@Verntrax

Compiler version

3.2.2

Minimized code

sealed trait Transformation[T]

case object Count extends Transformation[Int]
case class MultiTransformation[T1 <: Transformation[?], T2 <: Transformation[?]](t1: T1, t2: T2)
  extends Transformation[MultiTransformationResult[T1, T2]]

type MultiTransformationResult[T1 <: Transformation[?], T2 <: Transformation[?]] <: Tuple = (T1, T2) match {
  case (Transformation[t], MultiTransformation[t1, t2]) => t *: MultiTransformationResult[t1, t2]
  case (Transformation[t1], Transformation[t2]) => (t1, t2)
}

Output

children of trait Transformation were already queried before class MultiTransformation was discovered.
As a remedy, you could move class MultiTransformation on the same nesting level as trait Transformation.

Expectation

The code should either compile or the compiler should display a valid error message. In this case the error message is misleading as both trait and class already are on the same nesting level.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions