Skip to content

Ability to deprecate an export #48376

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

Closed
lrhn opened this issue Feb 11, 2022 · 2 comments
Closed

Ability to deprecate an export #48376

lrhn opened this issue Feb 11, 2022 · 2 comments
Labels
closed-duplicate Closed in favor of an existing report devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug

Comments

@lrhn
Copy link
Member

lrhn commented Feb 11, 2022

We can currently @Deprecate(...) a declaration, which should warn for any code that would change behavior if that declaration was removed.
I would like to be able to deprecate exports, so that code would get warned if they rely on that export for access to a declaration (they'd break if the export was removed, just as for declarations).

My use-case is that I want to move a declaration to another library. To do that, I want the same declaration to be temporarily available from both libraries, one deprecated and the other not.
Since it must be the same declaration (otherwise, their names would clash), I can't annotate the declaration itself without deprecating both sources.

So, instead I'd put the declaration into either one of the two libraries, or a shared third library, and export it deprecated from one library and not from the other.
Any user who imports both should get no warning (they have a non-deprecated path to the declaration).
Any user who imports only through the deprecated export will get a warning.

Eventually, the deprecated export goes away, and all is well.

(This has happened already with BytesBuilder moving from dart:io to dart:typed_data. There is a non-functional deprecation on the export in dart:io. It's happening again to me with another feature, hence this request.)

@lrhn lrhn added legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug labels Feb 11, 2022
@srawlins
Copy link
Member

Looks like a duplicate of #23067.

@srawlins srawlins added the devexp-warning Issues with the analyzer's Warning codes label Feb 28, 2022
@lrhn
Copy link
Member Author

lrhn commented Mar 1, 2022

Indeed.

@lrhn lrhn closed this as completed Mar 1, 2022
@lrhn lrhn added the closed-duplicate Closed in favor of an existing report label Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report devexp-warning Issues with the analyzer's Warning codes legacy-area-analyzer Use area-devexp instead. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants