-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
feature: support @deprecated in type constructors #3698
Comments
Sounds reasonable. Thank you. I think we would only emit for constructing the variant, we would not for pattern matching on it. It would be an error to have deprecated attributes on all variants. |
pub type Numbers {
@deprecated("no")
One
@deprecated("no")
Two
}
──── Code action ────
@deprecated("<message>")
pub type Numbers {
One
Two
} pub type Numbers {
@deprecated("no")
One
}
//─── Errors out ────
//Can't deprecate all variants of a type. Consider deprecating the type as a whole. pub type Numbers {
@deprecated("no")
One
}
//─── LSP ────
//Can't deprecate all variants of a type. Consider deprecating the type as a whole.
//─── `gleam run` ───
//Warning:
// ... code ..
//Fix: Can't deprecate all variants of a type. Consider deprecating the type as a whole. |
When parsing the Constructor's attributes only the
Sorry, but I'm unsure what you mean by this. |
It would be better to error during analysis such that the LS can continue to function. I don't think a code action would be very valuable, we should focus on other code actions instead. Perhaps in the far-future. It means the warning would not be emitted if you use a deprecated constructor in a pattern. I'm not entirely sure this is a good idea. My reasoning was that you would still need to pattern match on it as it's still possible even if it is deprecated, but then you may miss this use when moving away from the deprecated variant in your code in order to upgrade. |
Currently, the
@deprecated
tag is only supported with functions and top-level of a type.The text was updated successfully, but these errors were encountered: