Skip to content

Definitions within Enum should report errors #15900

Open
@b-studios

Description

@b-studios

Compiler version

Latest dotty on Scastie (3.2.0-RC1)

Minimized code

enum MyEnum {
  case class Foo(n: Int)

  case Constructor(field: Foo)
}

Output

enum MyEnum {
  case class Foo(n: Int)

  case Constructor(field: Foo)
  // Not found: type Foo  ^^^
}

Expectation

If definitions within enums cannot be referred to, they should be forbidden. The error message in this case should be something along the lines of:

enum MyEnum {
  case class Foo(n: Int)
 // case class definitions in enum not allowed. 

  case Constructor(field: Foo) 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions