Skip to content

Cyclic reference involving variable with match type #13495

Closed
@ndido98

Description

@ndido98

Compiler version

Scala 3.0.2 (Scastie)

Minimized code

import scala.annotation.showAsInfix

trait Component
sealed trait Deleted extends Component

type Deletable[L <: CList] <: CList = L match {
  case h &: t => (h | Deleted) &: Deletable[t]
  case CNil => CNil
}

sealed trait CList
sealed trait CNil extends CList
@showAsInfix case class &:[+C <: Component, +L <: CList](h: C, t: L) extends CList

case class A(x: Int, y: Int) extends Component
case class B(x: Int, y: Int) extends Component

val x: Deletable[A &: B &: CNil] = ???

Output

Compiler error:

Cyclic reference involving val x

Expectation

No compiler error. I expect the type of x to be (A | Deleted) &: (B | Deleted) &: CNil.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions