Skip to content

Cyclic reference for top-level definitions of recursive match types #6362

Closed
@flomebul

Description

@flomebul

The following exemple no more accepted

  type LeafElem[X] = X match {
      case String => Char
      case Array[t] => LeafElem[t]
      case Iterable[t] => LeafElem[t]
      case AnyVal => X
    }

with the following error

-- Error: recursive.scala:11:7 -------------------------------------------------
11 |  type LeafElem[X] = X match {
   |       ^
   |illegal cyclic reference: match ... (caught cyclic reference) ... of      |type LeafElem refers back to the type itself

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions