Skip to content

"illegal cyclic reference" again #11963

@dubinsky

Description

@dubinsky

reproduction steps

object IllegalCyclicReference {
  trait Number[S <: Numbers[S], N <: Number[S, N]] { this: N => }
  trait PointNumber[S <: Numbers[S]] extends Number[S, S#Point] {
    this: S#Point => } // Error No 1
  trait Numbers[S <: Numbers[S]] { this: S =>
    type Point <: PointNumber[S]
  }
  trait Times[S <: Times[S]] extends Numbers[S] { this: S =>
    override type Point <: PointNumber[S] with Number[S, S#Point]  // Error No 2
  }
  trait Angles extends Numbers[Angles] {
    override type Point = PointNumber[Angles]
  }
}

problem

With Scala 2.13.0, 2.13.1 and 2.13.2:

[Error No 1] ... illegal cyclic reference involving trait PointNumber
[Error No 2] ... illegal cyclic reference involving type Point

expectation

BUILD SUCCESSFUL

like with Scala 2.12.10 :)

I do not understand if this is related to #11640 (or #11734) or is actually illegal in Scala 2.13 (and Dotty). I wasn't able to find a work-around :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions