Display constructor names in annotations #4115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two changes in one here:
@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
).@Deprecated("reason")
annotations be printed as@Deprecated.new("reason")
. That.new
looks very non-idiomatic. Gross. So I coupled another change here where we overridedisplayName
onConstructor
to not include.new
if we're looking at an unnamed constructor.This should be good to go. We might deprecate extending
RegExp
andRegExpMatch
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 asstruck through, so the release is safe. But this PR would be a cherry on top.Fixes #4107