Skip to content

Incorrect "Illegal reference to type from enum case" in companion object #11081

Closed
@Katrix

Description

@Katrix

Not quite sure what's happening here, as I'm in the companion object, where I would expect stuff to behave like any other object.

Minimized code

enum Outer:
  case Foo
object Outer:
  trait Bar
  case class Baz(bar: Bar)

Output

illegal reference to trait Bar from enum case

Expectation

It compiles, or at least gives a better error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions