Skip to content

Conversation

srawlins
Copy link
Member

@srawlins srawlins commented Oct 3, 2025

Two changes in one here:

  • I saw in manual testing that a class annotated with @Deprecated.extend() was shown in dartdoc's HTML to just be annotated with @Deprecated. 🤕 ouch. Dunno how that has been the case for so many years; I guess named constructors are not used too much in annotations 🤷 . So this PR makes dartdoc use the constructor involved (Deprecated.extend) instead of the type which is constructed (Deprecated).
  • However, that change makes all regular @Deprecated("reason") annotations be printed as @Deprecated.new("reason"). That .new looks very non-idiomatic. Gross. So I coupled another change here where we override displayName on Constructor to not include .new if we're looking at an unnamed constructor.

This should be good to go. We might deprecate extending RegExp and RegExpMatch in Dart 3.10; it'd be cool if we displayed the deprecated annotations correctly for this release. Note that as per 669b15f, we won't show the element as struck through, so the release is safe. But this PR would be a cherry on top.

Fixes #4107

@srawlins srawlins requested a review from szakarias October 3, 2025 22:56
Copy link
Contributor

@szakarias szakarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

@szakarias szakarias merged commit 45ba6ed into dart-lang:main Oct 7, 2025
13 checks passed
@srawlins srawlins deleted the named-ctor-ann branch October 9, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for new Deprecated annotations
2 participants