Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecating uses of an enum #12939

Open
HertzDevil opened this issue Jan 11, 2023 · 0 comments
Open

Deprecating uses of an enum #12939

HertzDevil opened this issue Jan 11, 2023 · 0 comments

Comments

@HertzDevil
Copy link
Contributor

#11680 allows @[Deprecated] to work on constants. The same isn't true for enums:

@[Deprecated]
enum Foo
  @[Deprecated]
  Bar
end

@[Deprecated]
module Foo2
  @[Deprecated]
  Bar2 = 1
end

Foo::Bar
Foo2::Bar2 # Warning: Deprecated Foo2::Bar2.

Foo
Foo2

Ideally, @[Deprecated] on an enum member should deprecate just that member, and @[Deprecated] on an enum type should deprecate all of its members, including the implicitly generated None and All. Using Foo or Foo2 itself should also trigger a deprecation warning as part of #11043.

The compiler completely ignores annotations on enum members, but as a side effect of #12044 this is now doable because enum members are somehow represented by Arg nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant