diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md index c0387497592..2fb5385a7de 100644 --- a/pkg/meta/CHANGELOG.md +++ b/pkg/meta/CHANGELOG.md @@ -1,3 +1,10 @@ +## 1.14.0-wip + +* Introduce `TargetKind.constructor`, to indicate that an annotation is valid on + any constructor. +* Introduce `TargetKind.typeParamteer`, to indicate that an annotation is valid + on any type parameter. + ## 1.13.0 * Add type checks for the `@ResourceIdentifier` experimental annotation. @@ -6,20 +13,19 @@ * Introduce the `@ResourceIdentifier` experimental annotation for static methods whose constant literal arguments should be collected during compilation. -* Indicate that `@required` and `@Required` are set - to be deprecated for later removal. +* Indicate that `@required` and `@Required` are set to be deprecated for later + removal. ## 1.11.0 -* Introduce `TargetKind.extensionType` to indicate that an annotation - is valid on any extension type declaration. +* Introduce `TargetKind.extensionType` to indicate that an annotation is valid + on any extension type declaration. ## 1.10.0 * Introduce `@redeclare` to annotate extension type members that redeclare members from a superinterface. -* Migrate the `TargetKind` enum to a class to ease the addition of new - kinds. +* Migrate the `TargetKind` enum to a class to ease the addition of new kinds. ## 1.9.1 @@ -64,8 +70,8 @@ * Introduce `TargetKind.topLevelVariable` that indicates that an annotation is valid on any top-level variable declaration. -* Introduce `@useResult` to annotate methods, fields, or getters that - return values that should be used - stored, passed as arguments, etc. +* Introduce `@useResult` to annotate methods, fields, or getters that return + values that should be used - stored, passed as arguments, etc. * Updates for documentation. ## 1.3.0 @@ -75,11 +81,11 @@ ## 1.3.0-nullsafety.6 * Update SDK constraints to `>=2.12.0-0 <3.0.0` based on beta release - guidelines. + guidelines. ## 1.3.0-nullsafety.5 -* Allow prerelease versions of the `2.12` sdk. +* Allow prerelease versions of the `2.12` SDK. ## 1.3.0-nullsafety.4 @@ -92,11 +98,11 @@ ## 1.3.0-nullsafety.2 -* Update for the 2.10 dev sdk. +* Update for the 2.10 dev SDK. ## 1.3.0-nullsafety.1 -* Allow the <=2.9.10 stable sdk. +* Allow the <=2.9.10 stable SDK. ## 1.3.0-nullsafety @@ -119,9 +125,9 @@ * Introduce `unawaited` to mark invocations that return a `Future` where it's intentional that the future is not being awaited. (Moved from `package:pedantic`.) -* Introduce `@doNotStore` to annotate methods, getters and functions to - indicate that values obtained by invoking them should not be stored in a - field or top-level variable. +* Introduce `@doNotStore` to annotate methods, getters and functions to indicate + that values obtained by invoking them should not be stored in a field or + top-level variable. ## 1.1.8 diff --git a/pkg/meta/lib/meta_meta.dart b/pkg/meta/lib/meta_meta.dart index 62fc36ce2ee..f1de463ade6 100644 --- a/pkg/meta/lib/meta_meta.dart +++ b/pkg/meta/lib/meta_meta.dart @@ -42,6 +42,12 @@ class TargetKind { /// Indicates that an annotation is valid on any class declaration. static const classType = TargetKind._('classes', 'classType'); + /// Indicates that an annotation is valid on any constructor declaration, both + /// factory and generative constructors, whether it's in a class, enum, or + /// extension type. Extension type primary constructors are not supported, + /// because there is no way to annotate a primary constructor. + static const constructor = TargetKind._('constructors', 'constructor'); + /// Indicates that an annotation is valid on any enum declaration. static const enumType = TargetKind._('enums', 'enumType'); @@ -52,7 +58,8 @@ class TargetKind { static const extensionType = TargetKind._('extension types', 'extensionType'); /// Indicates that an annotation is valid on any field declaration, both - /// instance and static fields, whether it's in a class, mixin or extension. + /// instance and static fields, whether it's in a class, enum, mixin, or + /// extension. static const field = TargetKind._('fields', 'field'); /// Indicates that an annotation is valid on any top-level function @@ -65,24 +72,26 @@ class TargetKind { static const library = TargetKind._('libraries', 'library'); /// Indicates that an annotation is valid on any getter declaration, both - /// instance or static getters, whether it's in a class, mixin, extension, or - /// at the top-level of a library. + /// instance or static getters, whether it's in a class, enum, mixin, + /// extension, extension type, or at the top-level of a library. static const getter = TargetKind._('getters', 'getter'); /// Indicates that an annotation is valid on any method declaration, both - /// instance and static methods, whether it's in a class, mixin or extension. + /// instance and static methods, whether it's in a class, enum, mixin, + /// extension, or extension type. static const method = TargetKind._('methods', 'method'); /// Indicates that an annotation is valid on any mixin declaration. static const mixinType = TargetKind._('mixins', 'mixinType'); /// Indicates that an annotation is valid on any formal parameter declaration, - /// whether it's in a function (named or anonymous), method, or constructor. + /// whether it's in a constructor, function (named or anonymous), function + /// type, function-typed formal parameter, or method. static const parameter = TargetKind._('parameters', 'parameter'); /// Indicates that an annotation is valid on any setter declaration, both - /// instance or static setters, whether it's in a class, mixin, extension, or - /// at the top-level of a library. + /// instance or static setters, whether it's in a class, enum, mixin, + /// extension, extension type, or at the top-level of a library. static const setter = TargetKind._('setters', 'setter'); /// Indicates that an annotation is valid on any top-level variable @@ -91,24 +100,25 @@ class TargetKind { TargetKind._('top-level variables', 'topLevelVariable'); /// Indicates that an annotation is valid on any declaration that introduces a - /// type. This includes classes, enums, mixins and typedefs, but does not + /// type. This includes classes, enums, mixins, and typedefs, but does not /// include extensions because extensions don't introduce a type. + // TODO(srawlins): This should include extension types. static const type = TargetKind._('types (classes, enums, mixins, or typedefs)', 'type'); - /// Indicates that an annotation is valid on any typedef declaration.` + /// Indicates that an annotation is valid on any typedef declaration. static const typedefType = TargetKind._('typedefs', 'typedefType'); /// Indicates that an annotation is valid on any type parameter declaration, /// whether it's on a class, enum, function type, function, mixin, extension, /// extension type, or typedef. - static const typeParameter = TargetKind._( - 'type parameters (classes, enums, mixins, or typedefs)', 'typeParameter'); + static const typeParameter = TargetKind._('type parameters', 'typeParameter'); /// All current [TargetKind] values of targets to /// which an annotation can be applied. static const values = [ classType, + constructor, enumType, extension, extensionType, @@ -122,8 +132,8 @@ class TargetKind { setter, topLevelVariable, type, - typeParameter, typedefType, + typeParameter, ]; /// A user visible string used to describe this target kind. diff --git a/pkg/meta/pubspec.yaml b/pkg/meta/pubspec.yaml index be2dcf953c0..895e879c228 100644 --- a/pkg/meta/pubspec.yaml +++ b/pkg/meta/pubspec.yaml @@ -1,7 +1,7 @@ name: meta # Note, because version `2.0.0` was mistakenly released, # the next major version must be `3.x.y`. -version: 1.13.0 +version: 1.14.0-wip description: >- Annotations used to express developer intentions that can't otherwise be deduced by statically analyzing source code.