Skip to content

Deprecating a type parameter doesn't warn when the parameter is used. #57012

@rrousselGit

Description

@rrousselGit

Describe the issue

In some cases, a package may want one class to stop being used with generics.
For example, Riverpod refactored Ref<StateT> to just Ref.

This change is done with:

+@optionalTypeArgs
class Ref<
+  @deprecated
  T> {}

The problem is, existing references to the type parameter does not cause a warning.

To Reproduce

@optionalTypeArgs
class Ref<@deprecated  T> {}

Ref<int>? value; 

Expected behavior

This should warn on <int> that the type parameter is deprecated

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-warningIssues with the analyzer's Warning codestype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions