lampepfl / dotty-feature-requests

Historical feature requests. Please create new feature requests at https://github.com/lampepfl/dotty/discussions/new?category=feature-requests
31 stars 2 forks source link

how to evolve enum to add experimental cases? #266

Closed bishabosha closed 1 year ago

bishabosha commented 3 years ago

Compiler version

3.1.0

Minimized code

enum Foo:
  @annotation.experimental case A

Output

-- Error:
2 |  @annotation.experimental case A
  |  ^
  |value A is marked @experimental and therefore may only be used in an experimental scope.

Expectation

The error makes sense, as values, valueOf, fromOrdinal etc reference A, but it does mean we can not "evolve" our enum to add new cases without making every method experimental.

Or perhaps those methods should all automatically become experimental as soon as an experimental case is added? (not good for downstream users of a library)

odersky commented 2 years ago

If we really care about this (I personally do not see a strong usecase), this should be a feature request.