Skip to content

enum with AnyKind-ed type param instantiated to different kinds does not compile #22003

Open
@TomasMikula

Description

@TomasMikula

Compiler version

3.5.0
3.6.1

Minimized code

enum Foo[T <: AnyKind]:
  case Bar extends Foo[List]
  case Baz extends Foo[Map]

Output

Found:    (Playground.Foo.Bar : Playground.Foo[List]) |
  (Playground.Foo.Baz : Playground.Foo[Map])
Required: Playground.Foo[? >: List[?] & Map[?, ?] <: List[?] | Map[?, ?]]

https://scastie.scala-lang.org/A8kJXNH1QMSMPOQe6DmCJg

Expectation

It should compile, like this equivalent sealed family:

// compiles
sealed trait Foo[T <: AnyKind]
case object Bar extends Foo[List]
case object Baz extends Foo[Map]

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