Skip to content

Intersection type with refined type member as upper bound does not compile #4623

Closed
@pweisenburger

Description

@pweisenburger

The following code compiles using Scala:

trait Test {
  type A <: Any { type T }
  type B <: Any { type T }
  type C <: A with B { type T }
}

Dotty produces the following compiler error:

4 |  type C <: A with B { type T }
  |            ^
  |            class Any is extended twice

Notably, the following code compiles:

trait Test {
  type A <: Any
  type B <: Any
  type C <: A with B
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions