Version 2.14.0-143.0.dev
Merge commit '0b7a8656f80d749b8f65ef9ebb24540549584b4d' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 873b751..b402bc7 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
- "generated": "2021-05-17T10:34:01.378194",
+ "generated": "2021-05-21T16:08:02.444059",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@@ -387,7 +387,7 @@
"name": "js_ast",
"rootUri": "../pkg/js_ast",
"packageUri": "lib/",
- "languageVersion": "2.0"
+ "languageVersion": "2.10"
},
{
"name": "js_runtime",
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 6d5c3de..f85b97b 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -1168,10 +1168,12 @@
*/
// #### Description
//
- // The analyzer produces this diagnostic when the name of an extension is a
- // built-in identifier. Built-in identifiers can’t be used as extension names.
+ // The analyzer produces this diagnostic when the name used in the declaration
+ // of a class, extension, mixin, typedef, type parameter, or import prefix is
+ // a built-in identifier. Built-in identifiers can’t be used to name any of
+ // these kinds of declarations.
//
- // #### Examples
+ // #### Example
//
// The following code produces this diagnostic because `mixin` is a built-in
// identifier:
@@ -1182,22 +1184,15 @@
//
// #### Common fixes
//
- // Choose a different name for the extension.
- // TODO(brianwilkerson) When the documentation for
- // 'BUILT_IN_IDENTIFIER_IN_DECLARATION' is committed it should replace the
- // text above and the name of this code should be changed to match it. We
- // also need to add a forward for this code at the same time.
+ // Choose a different name for the declaration.
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME =
- CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME',
+ CompileTimeErrorCode('BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as an extension name.",
correction: "Try choosing a different name for the extension.",
- hasPublishedDocs: true);
+ hasPublishedDocs: true,
+ uniqueName: 'BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME');
/**
- * 16.33 Identifier Reference: It is a compile-time error if a built-in
- * identifier is used as the declared name of a prefix, class, type parameter
- * or type alias.
- *
* Parameters:
* 0: the built-in identifier that is being used
*/
@@ -1239,10 +1234,6 @@
hasPublishedDocs: true);
/**
- * 16.33 Identifier Reference: It is a compile-time error if a built-in
- * identifier is used as the declared name of a prefix, class, type parameter
- * or type alias.
- *
* Parameters:
* 0: the built-in identifier that is being used
*/
@@ -1253,10 +1244,6 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME');
/**
- * 16.33 Identifier Reference: It is a compile-time error if a built-in
- * identifier is used as the declared name of a prefix, class, type parameter
- * or type alias.
- *
* Parameters:
* 0: the built-in identifier that is being used
*/
@@ -1269,10 +1256,6 @@
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME');
/**
- * 16.33 Identifier Reference: It is a compile-time error if a built-in
- * identifier is used as the declared name of a prefix, class, type parameter
- * or type alias.
- *
* Parameters:
* 0: the built-in identifier that is being used
*/
@@ -1576,13 +1559,41 @@
hasPublishedDocs: true);
/**
- * 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
- * error if `C` declares a constructor named `C.n`, and a static member with
- * basename `n`.
- *
* Parameters:
* 0: the name of the field
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a named constructor and either a
+ // static method or static field have the same name. Both are accessed using
+ // the name of the class, so having the same name makes the reference
+ // ambiguous.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the static field `foo`
+ // and the named constructor `foo` have the same name:
+ //
+ // ```dart
+ // class C {
+ // C.[!foo!]();
+ // static int foo = 0;
+ // }
+ // ```
+ //
+ // The following code produces this diagnostic because the static method `foo`
+ // and the named constructor `foo` have the same name:
+ //
+ // ```dart
+ // class C {
+ // C.[!foo!]();
+ // static void foo() {}
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Rename either the member or the constructor.
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD =
CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_AND_STATIC_MEMBER',
@@ -1592,10 +1603,6 @@
uniqueName: 'CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD');
/**
- * 10.11 Class Member Conflicts: Let `C` be a class. It is a compile-time
- * error if `C` declares a constructor named `C.n`, and a static member with
- * basename `n`.
- *
* Parameters:
* 0: the name of the constructor
*/
@@ -3169,6 +3176,40 @@
correction: "Try renaming one of the declarations.",
hasPublishedDocs: true);
+ /**
+ * Parameters:
+ * 0: the name of the field
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when there's more than one field
+ // formal parameter for the same field in a constructor's parameter list. It
+ // isn't useful to assign a value that will immediately be overwritten.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because `this.f` appears twice
+ // in the parameter list:
+ //
+ // ```dart
+ // class C {
+ // int f;
+ //
+ // C(this.f, this.[!f!]) {}
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Remove one of the field formal parameters:
+ //
+ // ```dart
+ // class C {
+ // int f;
+ //
+ // C(this.f) {}
+ // }
+ // ```
static const CompileTimeErrorCode DUPLICATE_FIELD_FORMAL_PARAMETER =
CompileTimeErrorCode(
'DUPLICATE_FIELD_FORMAL_PARAMETER',
@@ -3459,11 +3500,26 @@
hasPublishedDocs: true);
/**
- * SDK implementation libraries can be exported only by other SDK libraries.
- *
* Parameters:
* 0: the uri pointing to a library
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when it finds an export whose `dart:`
+ // URI references an internal library.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because `_interceptors` is an
+ // internal library:
+ //
+ // ```dart
+ // export [!'dart:_interceptors'!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Remove the export directive.
static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY =
CompileTimeErrorCode('EXPORT_INTERNAL_LIBRARY',
"The library '{0}' is internal and can't be exported.");
@@ -3758,11 +3814,41 @@
hasPublishedDocs: true,
isUnresolvedIdentifier: true);
+ /**
+ * No parameters.
+ */
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a type alias that expands to a
+ // type parameter is used in an `extends`, `implements`, `with`, or `on`
+ // clause.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the type alias `T`,
+ // which expands to the type parameter `S`, is used in the `extends` clause of
+ // the class `C`:
+ //
+ // ```dart
+ // typedef T<S> = S;
+ //
+ // class C extends [!T!]<Object> {}
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Use the value of the type argument directly:
+ //
+ // ```dart
+ // typedef T<S> = S;
+ //
+ // class C extends Object {}
+ // ```
static const CompileTimeErrorCode
EXTENDS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
- "Type aliases that expand to a type parameter can't be used as "
- "superclasses.",
+ "A type alias that expands to a type parameter can't be used as a "
+ "superclass.",
correction:
"Try specifying a different superclass, or removing the extends "
"clause.",
@@ -5359,10 +5445,13 @@
correction: "Try removing one of the occurrences.",
hasPublishedDocs: true);
+ /**
+ * No parameters.
+ */
static const CompileTimeErrorCode
IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
- "Type aliases that expand to a type parameter can't be implemented.",
+ "A type alias that expands to a type parameter can't be implemented.",
correction: "Try specifying a class or mixin, or removing the list.",
uniqueName: 'IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER');
@@ -5627,15 +5716,61 @@
hasPublishedDocs: true);
/**
- * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
- * is a compile-time error if <i>k</i>'s initializer list contains an
- * initializer for a variable that is not an instance variable declared in the
- * immediately surrounding class.
- *
* Parameters:
* 0: the name of the initializing formal that is a static variable in the
* immediately enclosing class
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a static field is initialized in
+ // a constructor using either a field formal parameter or an assignment in the
+ // initializer list.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the static field `a` is
+ // being initialized by the field formal parameter `this.a`:
+ //
+ // ```dart
+ // class C {
+ // static int? a;
+ // C([!this.a!]);
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the field should be an instance field, then remove the keyword `static`:
+ //
+ // ```dart
+ // class C {
+ // int? a;
+ // C(this.a);
+ // }
+ // ```
+ //
+ // If you intended to initialize an instance field and typed the wrong name,
+ // then correct the name of the field being initialized:
+ //
+ // ```dart
+ // class C {
+ // static int? a;
+ // int? b;
+ // C(this.b);
+ // }
+ // ```
+ //
+ // If you really want to initialize the static field, then move the
+ // initialization into the constructor body:
+ //
+ // ```dart
+ // class C {
+ // static int? a;
+ // C(int? c) {
+ // a = c;
+ // }
+ // }
+ // ```
static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD =
CompileTimeErrorCode(
'INITIALIZER_FOR_STATIC_FIELD',
@@ -6083,8 +6218,8 @@
"constructor invocation.",
hasPublishedDocs: true);
-
- static const CompileTimeErrorCode INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY =
+ static const CompileTimeErrorCode
+ INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY =
CompileTimeErrorCode(
'INVALID_ANNOTATION_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY',
"Constant values from a deferred library can't be used in annotations.",
@@ -6557,18 +6692,91 @@
hasPublishedDocs: true);
/**
- * 9. Functions: It is a compile-time error if an async, async* or sync*
- * modifier is attached to the body of a setter or constructor.
+ * Parameters:
+ * 0: the invalid modifier
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the body of a constructor is
+ // prefixed by one of the following modifiers: `async`, `async*`, or `sync*`.
+ // Constructor bodies must be synchronous.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the body of the
+ // constructor for `C` is marked as being `async`:
+ //
+ // ```dart
+ // class C {
+ // C() [!async!] {}
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the constructor can be synchronous, then remove the modifier:
+ //
+ // ```dart
+ // class C {
+ // C();
+ // }
+ // ```
+ //
+ // If the constructor can't be synchronous, then use a static method to create
+ // the instance instead:
+ //
+ // ```dart
+ // class C {
+ // C();
+ // static Future<C> c() async {
+ // return C();
+ // }
+ // }
+ // ```
static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR =
CompileTimeErrorCode('INVALID_MODIFIER_ON_CONSTRUCTOR',
"The modifier '{0}' can't be applied to the body of a constructor.",
correction: "Try removing the modifier.");
/**
- * 9. Functions: It is a compile-time error if an async, async* or sync*
- * modifier is attached to the body of a setter or constructor.
+ * Parameters:
+ * 0: the invalid modifier
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the body of a setter is prefixed
+ // by one of the following modifiers: `async`, `async*`, or `sync*`. Setter
+ // bodies must be synchronous.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the body of the setter
+ // `x` is marked as being `async`:
+ //
+ // ```dart
+ // class C {
+ // set x(int i) [!async!] {}
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the setter can be synchronous, then remove the modifier:
+ //
+ // ```dart
+ // class C {
+ // set x(int i) {}
+ // }
+ // ```
+ //
+ // If the setter can't be synchronous, then use a method to set the value
+ // instead:
+ //
+ // ```dart
+ // class C {
+ // void x(int i) async {}
+ // }
+ // ```
static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER =
CompileTimeErrorCode('INVALID_MODIFIER_ON_SETTER',
"The modifier '{0}' can't be applied to the body of a setter.",
@@ -7720,26 +7928,112 @@
hasPublishedDocs: true);
/**
- * It's a compile-time error to apply a mixin containing super-invocations to
- * a class that doesn't have a concrete implementation of the super-invoked
- * members compatible with the super-constraint interface.
- *
- * This ensures that if more than one super-constraint interface declares a
- * member with the same name, at least one of those members is more specific
- * than the rest, and this is the unique signature that super-invocations
- * are allowed to invoke.
- *
* Parameters:
* 0: the name of the super-invoked member
* 1: the display name of the type of the super-invoked member in the mixin
* 2: the display name of the type of the concrete member in the class
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a mixin that invokes a method
+ // using `super` is used in a class where the concrete implementation of that
+ // method has a different signature than the signature defined for that method
+ // by the mixin's `on` type. The reason this is an error is because the
+ // invocation in the mixin might invoke the method in a way that's
+ // incompatible with the method that will actually be executed.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the class `C` uses the
+ // mixin `M`, the mixin `M` invokes `foo` using `super`, and the abstract
+ // version of `foo` declared in `I` (the mixin's `on` type) doesn't have the
+ // same signature as the concrete version of `foo` declared in `A`:
+ //
+ // ```dart
+ // class I {
+ // void foo([int? p]) {}
+ // }
+ //
+ // class A {
+ // void foo(int p) {}
+ // }
+ //
+ // abstract class B extends A implements I {
+ // @override
+ // void foo([int? p]);
+ // }
+ //
+ // mixin M on I {
+ // void bar() {
+ // super.foo(42);
+ // }
+ // }
+ //
+ // abstract class C extends B with [!M!] {}
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the class doesn't need to use the mixin, then remove it from the `with`
+ // clause:
+ //
+ // ```dart
+ // class I {
+ // void foo([int? p]) {}
+ // }
+ //
+ // class A {
+ // void foo(int? p) {}
+ // }
+ //
+ // abstract class B extends A implements I {
+ // @override
+ // void foo([int? p]);
+ // }
+ //
+ // mixin M on I {
+ // void bar() {
+ // super.foo(42);
+ // }
+ // }
+ //
+ // abstract class C extends B {}
+ // ```
+ //
+ // If the class needs to use the mixin, then ensure that there's a concrete
+ // implementation of the method that conforms to the signature expected by the
+ // mixin:
+ //
+ // ```dart
+ // class I {
+ // void foo([int? p]) {}
+ // }
+ //
+ // class A {
+ // void foo(int? p) {}
+ // }
+ //
+ // abstract class B extends A implements I {
+ // @override
+ // void foo([int? p]) {
+ // super.foo(p);
+ // }
+ // }
+ //
+ // mixin M on I {
+ // void bar() {
+ // super.foo(42);
+ // }
+ // }
+ //
+ // abstract class C extends B with M {}
+ // ```
static const CompileTimeErrorCode
MIXIN_APPLICATION_CONCRETE_SUPER_INVOKED_MEMBER_TYPE =
CompileTimeErrorCode(
'MIXIN_APPLICATION_CONCRETE_SUPER_INVOKED_MEMBER_TYPE',
- "The super-invoked member '{0}' has the type '{1}', but the "
- "concrete member in the class has type '{2}'.");
+ "The super-invoked member '{0}' has the type '{1}', and the concrete "
+ "member in the class has the type '{2}'.");
/**
* Parameters:
@@ -7820,14 +8114,43 @@
hasPublishedDocs: true);
/**
- * It's a compile-time error to apply a mixin to a class that doesn't
- * implement all the `on` type requirements of the mixin declaration.
- *
* Parameters:
* 0: the display name of the mixin
* 1: the display name of the superclass
* 2: the display name of the type that is not implemented
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a mixin that has a superclass
+ // constraint is used in a [mixin application][] with a superclass that
+ // doesn't implement the required constraint.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the mixin `M` requires
+ //that the class to which it's applied be a subclass of `A`, but `Object`
+ // isn't a subclass of `A`:
+ //
+ // ```dart
+ // class A {}
+ //
+ // mixin M on A {}
+ //
+ // class X = Object with [!M!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If you need to use the mixin, then change the superclass to be either the
+ // same as or a subclass of the superclass constraint:
+ //
+ // ```dart
+ // class A {}
+ //
+ // mixin M on A {}
+ //
+ // class X = A with M;
+ // ```
static const CompileTimeErrorCode
MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE = CompileTimeErrorCode(
'MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE',
@@ -7836,12 +8159,58 @@
correction: "Try extending the class '{0}'.");
/**
- * 9 Mixins: It is a compile-time error if a declared or derived mixin
- * explicitly declares a constructor.
- *
* Parameters:
* 0: the name of the mixin that is invalid
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a class is used as a mixin and
+ // the mixed-in class defines a constructor.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the class `A`, which
+ // defines a constructor, is being used as a mixin:
+ //
+ // ```dart
+ // class A {
+ // A();
+ // }
+ //
+ // class B with [!A!] {}
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If it's possible to convert the class to a mixin, then do so:
+ //
+ // ```dart
+ // mixin A {
+ // }
+ //
+ // class B with A {}
+ // ```
+ //
+ // If the class can't be a mixin and it's possible to remove the constructor,
+ // then do so:
+ //
+ // ```dart
+ // class A {
+ // }
+ //
+ // class B with A {}
+ // ```
+ //
+ // If the class can't be a mixin and you can't remove the constructor, then
+ // try extending or implementing the class rather than mixing it in:
+ //
+ // ```dart
+ // class A {
+ // A();
+ // }
+ //
+ // class B extends A {}
+ // ```
static const CompileTimeErrorCode MIXIN_CLASS_DECLARES_CONSTRUCTOR =
CompileTimeErrorCode(
'MIXIN_CLASS_DECLARES_CONSTRUCTOR',
@@ -7887,17 +8256,68 @@
"mixin's supertype constraints");
/**
- * 9 Mixins: It is a compile-time error if a mixin is derived from a class
- * whose superclass is not Object.
- *
* Parameters:
* 0: the name of the mixin that is invalid
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a class that extends a class
+ // other than `Object` is used as a mixin.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the class `B`, which
+ // extends `A`, is being used as a mixin by `C`:
+ //
+ // ```dart
+ // class A {}
+ //
+ // class B extends A {}
+ //
+ // class C with [!B!] {}
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the class being used as a mixin can be changed to extend `Object`, then
+ // change it:
+ //
+ // ```dart
+ // class A {}
+ //
+ // class B {}
+ //
+ // class C with B {}
+ // ```
+ //
+ // If the class being used as a mixin can't be changed and the class that's
+ // using it extends `Object`, then extend the class being used as a mixin:
+ //
+ // ```dart
+ // class A {}
+ //
+ // class B extends A {}
+ //
+ // class C extends B {}
+ // ```
+ //
+ // If the class doesn't extend `Object` or if you want to be able to mix in
+ // the behavior from `B` in other places, then create a real mixin:
+ //
+ // ```dart
+ // class A {}
+ //
+ // mixin M on A {}
+ //
+ // class B extends A with M {}
+ //
+ // class C extends A with M {}
+ // ```
static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT =
CompileTimeErrorCode(
'MIXIN_INHERITS_FROM_NOT_OBJECT',
"The class '{0}' can't be used as a mixin because it extends a class "
- "other than Object.");
+ "other than 'Object'.");
/**
* No parameters.
@@ -7972,17 +8392,23 @@
'MIXIN_OF_NON_CLASS', "Classes can only mix in mixins and classes.",
hasPublishedDocs: true);
+ /**
+ * No parameters.
+ */
static const CompileTimeErrorCode
MIXIN_OF_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
- "Type aliases that expand to a type parameter can't be mixed in.",
+ "A type alias that expands to a type parameter can't be mixed in.",
uniqueName: 'MIXIN_OF_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER');
+ /**
+ * No parameters.
+ */
static const CompileTimeErrorCode
MIXIN_ON_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER = CompileTimeErrorCode(
'SUPERTYPE_EXPANDS_TO_TYPE_PARAMETER',
- "Type aliases that expand to a type parameter can't be used as"
- "superclass constraints.",
+ "A type alias that expands to a type parameter can't be used as a "
+ "superclass constraint.",
uniqueName: 'MIXIN_ON_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER');
/**
@@ -8069,13 +8495,92 @@
correction: "Try removing all but one of the redirections.");
/**
- * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor.
- * Then <i>k</i> may include at most one superinitializer in its initializer
- * list or a compile time error occurs.
+ * No parameters.
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the initializer list of a
+ // constructor contains more than one invocation of a constructor from the
+ // superclass. The initializer list is required to have exactly one such call,
+ // which can either be explicit or implicit.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the initializer list
+ // for `B`’s constructor invokes both the constructor `one` and the
+ // constructor `two` from the superclass `A`:
+ //
+ // ```dart
+ // class A {
+ // int? x;
+ // String? s;
+ // A.one(this.x);
+ // A.two(this.s);
+ // }
+ //
+ // class B extends A {
+ // B() : super.one(0), [!super.two('')!];
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If one of the super constructors will initialize the instance fully, then
+ // remove the other:
+ //
+ // ```dart
+ // class A {
+ // int? x;
+ // String? s;
+ // A.one(this.x);
+ // A.two(this.s);
+ // }
+ //
+ // class B extends A {
+ // B() : super.one(0);
+ // }
+ // ```
+ //
+ // If the initialization achieved by one of the super constructors can be
+ // performed in the body of the constructor, then remove its super invocation
+ // and perform the initialization in the body:
+ //
+ // ```dart
+ // class A {
+ // int? x;
+ // String? s;
+ // A.one(this.x);
+ // A.two(this.s);
+ // }
+ //
+ // class B extends A {
+ // B() : super.one(0) {
+ // s = '';
+ // }
+ // }
+ // ```
+ //
+ // If the initialization can only be performed in a constructor in the
+ // superclass, then either add a new constructor or modify one of the existing
+ // constructors so there's a constructor that allows all the required
+ // initialization to occur in a single call:
+ //
+ // ```dart
+ // class A {
+ // int? x;
+ // String? s;
+ // A.one(this.x);
+ // A.two(this.s);
+ // A.three(this.x, this.s);
+ // }
+ //
+ // class B extends A {
+ // B() : super.three(0, '');
+ // }
+ // ```
static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS =
CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS',
- "Constructor may have at most one 'super' initializer.",
+ "A constructor can have at most one 'super' initializer.",
correction: "Try removing all but one of the 'super' initializers.");
/**
@@ -8328,6 +8833,10 @@
* User friendly specialized error for [NON_GENERATIVE_CONSTRUCTOR]. This
* handles the case of `class E extends Exception` which will never work
* because [Exception] has no generative constructors.
+ *
+ * Parameters:
+ * 0: the name of the subclass
+ * 1: the name of the superclass
*/
static const CompileTimeErrorCode NO_GENERATIVE_CONSTRUCTORS_IN_SUPERCLASS =
CompileTimeErrorCode(
@@ -9236,20 +9745,54 @@
hasPublishedDocs: true);
/**
- * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
- * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>.
- * Let <i>k</i> be a generative constructor. It is a compile-time error if
- * class <i>S</i> does not declare a generative constructor named <i>S</i>
- * (respectively <i>S.id</i>)
- *
* Parameters:
* 0: the non-generative constructor
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the initializer list of a
+ // constructor invokes a constructor from the superclass, and the invoked
+ // constructor is a factory constructor. Only a generative constructor can be
+ // invoked in the initializer list.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the invocation of the
+ // constructor `super.one()` is invoking a factory constructor:
+ //
+ // ```dart
+ // class A {
+ // factory A.one() = B;
+ // A.two();
+ // }
+ //
+ // class B extends A {
+ // B() : [!super.one()!];
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the super invocation to invoke a generative constructor:
+ //
+ // ```dart
+ // class A {
+ // factory A.one() = B;
+ // A.two();
+ // }
+ //
+ // class B extends A {
+ // B() : super.two();
+ // }
+ // ```
+ //
+ // If the generative constructor is the unnamed constructor, and if there are
+ // no arguments being passed to it, then you can remove the super invocation.
static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR =
CompileTimeErrorCode(
'NON_GENERATIVE_CONSTRUCTOR',
- "The constructor '{0}' is a factory constructor, but must be a "
- "generative constructor to be a valid superinitializer.",
+ "The generative constructor '{0}' is expected, but a factory was "
+ "found.",
correction:
"Try calling a different constructor of the superclass, or "
"making the called constructor not be a factory constructor.");
@@ -9411,18 +9954,66 @@
hasPublishedDocs: true);
/**
- * 7.1.1 Operators: It is a static warning if the return type of the
- * user-declared operator []= is explicitly declared and not void.
+ * No parameters.
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a declaration of the operator
+ // `[]=` has a return type other than `void`.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the declaration of the
+ // operator `[]=` has a return type of `int`:
+ //
+ // ```dart
+ // class C {
+ // [!int!] operator []=(int index, int value) => 0;
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the return type to `void`:
+ //
+ // ```dart
+ // class C {
+ // void operator []=(int index, int value) => 0;
+ // }
+ // ```
static const CompileTimeErrorCode NON_VOID_RETURN_FOR_OPERATOR =
CompileTimeErrorCode('NON_VOID_RETURN_FOR_OPERATOR',
"The return type of the operator []= must be 'void'.",
correction: "Try changing the return type to 'void'.");
/**
- * 7.3 Setters: It is a static warning if a setter declares a return type
- * other than void.
+ * No parameters.
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a setter is defined with a
+ // return type other than `void`.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the setter `p` has a
+ // return type of `int`:
+ //
+ // ```dart
+ // class C {
+ // [!int!] set p(int i) => 0;
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the return type to `void` or omit the return type:
+ //
+ // ```dart
+ // class C {
+ // set p(int i) => 0;
+ // }
+ // ```
static const CompileTimeErrorCode NON_VOID_RETURN_FOR_SETTER =
CompileTimeErrorCode('NON_VOID_RETURN_FOR_SETTER',
"The return type of the setter must be 'void' or absent.",
@@ -10081,9 +10672,33 @@
hasPublishedDocs: true);
/**
- * 7.1.1 Operators: It is a compile-time error to declare an optional
- * parameter in an operator.
+ * No parameters.
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when one or more of the parameters in
+ // an operator declaration are optional.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the parameter `other`
+ // is an optional parameter:
+ //
+ // ```dart
+ // class C {
+ // C operator +([[!C? other!]]) => this;
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Make all of the parameters be required parameters:
+ //
+ // ```dart
+ // class C {
+ // C operator +(C other) => this;
+ // }
+ // ```
static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR =
CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR',
"Optional parameters aren't allowed when defining an operator.",
@@ -10181,18 +10796,47 @@
hasPublishedDocs: true);
/**
- * Parts: It is a static warning if the referenced part declaration <i>p</i>
- * names a library that does not have a library tag.
- *
* Parameters:
* 0: the URI of the expected library
* 1: the non-matching actual library name from the "part of" declaration
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a library that doesn't have a
+ // `library` directive (and hence has no name) contains a `part` directive and
+ // the `part of` directive in the part file uses a name to specify the library
+ // that it's a part of.
+ //
+ // #### Example
+ //
+ // Given a part file named `part_file.dart` containing the following code:
+ //
+ // ```dart
+ // %uri="lib/part_file.dart"
+ // part of lib;
+ // ```
+ //
+ // The following code produces this diagnostic because the library including
+ // the part file doesn't have a name even though the part file uses a name to
+ // specify which library it's a part of:
+ //
+ // ```dart
+ // part [!'part_file.dart'!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the `part of` directive in the part file to specify its library by
+ // URI:
+ //
+ // ```dart
+ // part of 'test.dart';
+ // ```
static const CompileTimeErrorCode PART_OF_UNNAMED_LIBRARY =
CompileTimeErrorCode(
'PART_OF_UNNAMED_LIBRARY',
- "Library is unnamed. Expected a URI not a library name '{0}' in the "
- "part-of directive.",
+ "The library is unnamed. A URI is expected, not a library name "
+ "'{0}', in the part-of directive.",
correction:
"Try changing the part-of directive to a URI, or try including a "
"different part.");
@@ -10517,19 +11161,29 @@
uniqueName: 'RECURSIVE_FACTORY_REDIRECT');
/**
- * 7.10 Superinterfaces: It is a compile-time error if the interface of a
- * class <i>C</i> is a superinterface of itself.
- *
- * 8.1 Superinterfaces: It is a compile-time error if an interface is a
- * superinterface of itself.
- *
- * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a
- * superclass of itself.
- *
* Parameters:
* 0: the name of the class that implements itself recursively
* 1: a string representation of the implements loop
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when there's a circularity in the
+ // type hierarchy. This happens when a type, either directly or indirectly,
+ // is declared to be a subtype of itself.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the class `A` is
+ // declared to be a subtype of `B`, and `B` is a subtype of `A`:
+ //
+ // ```dart
+ // class [!A!] extends B {}
+ // class B implements A {}
+ // ```
+ //
+ // #### Common fixes
+ //
+ // Change the type hierarchy so that there's no circularity.
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE =
CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE',
"'{0}' can't be a superinterface of itself: {1}.",
@@ -11132,9 +11786,46 @@
hasPublishedDocs: true);
/**
- * 13.12 Return: It is a compile-time error if a return statement of the form
- * <i>return e;</i> appears in a generator function.
+ * Parameters:
+ * 0: the modifier that makes the function a generator
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a generator function (one whose
+ // body is marked with either `async*` or `sync*`) uses a `return` statement
+ // to return a value. In both cases, they should use `yield` instead of
+ // `return`.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the method `f` is a
+ // generator and is using `return` to return a value:
+ //
+ // ```dart
+ // Iterable<int> f() sync* {
+ // [!return 3!];
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the method is intended to be a generator, then use `yield` to return a
+ // value:
+ //
+ // ```dart
+ // Iterable<int> f() sync* {
+ // yield 3;
+ // }
+ // ```
+ //
+ // If the method isn't intended to be a generator, then remove the modifier
+ // from the body (or use `async` if you're returning a future):
+ //
+ // ```dart
+ // int f() {
+ // return 3;
+ // }
+ // ```
static const CompileTimeErrorCode RETURN_IN_GENERATOR = CompileTimeErrorCode(
'RETURN_IN_GENERATOR',
"Can't return a value from a generator function (using the '{0}' "
@@ -11302,6 +11993,35 @@
* 0: the actual type of the set element
* 1: the expected type of the set element
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when an element in a set literal has
+ // a type that isn't assignable to the element type of the set.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the type of the string
+ // literal `'0'` is `String`, which isn't assignable to `int`, the element
+ // type of the set:
+ //
+ // ```dart
+ // var s = <int>{[!'0'!]};
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the element type of the set literal is wrong, then change the element
+ // type of the set:
+ //
+ // ```dart
+ // var s = <String>{'0'};
+ // ```
+ //
+ // If the type of the element is wrong, then change the element:
+ //
+ // ```dart
+ // var s = <int>{'0'.length};
+ // ```
static const CompileTimeErrorCode SET_ELEMENT_TYPE_NOT_ASSIGNABLE =
CompileTimeErrorCode('SET_ELEMENT_TYPE_NOT_ASSIGNABLE',
"The element type '{0}' can't be assigned to the set type '{1}'.");
@@ -11642,6 +12362,45 @@
* 0: the element whose type could not be inferred.
* 1: The [TopLevelInferenceError]'s arguments that led to the cycle.
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when a top-level variable has no type
+ // annotation and the variable's initializer refers to the variable, either
+ // directly or indirectly.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the variables `x` and
+ // `y` are defined in terms of each other, and neither has an explicit type,
+ // so the type of the other can't be inferred:
+ //
+ // ```dart
+ // var x = y;
+ // var y = [!x!];
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the two variables don't need to refer to each other, then break the
+ // cycle:
+ //
+ // ```dart
+ // var x = 0;
+ // var y = x;
+ // ```
+ //
+ // If the two variables need to refer to each other, then give at least one of
+ // them an explicit type:
+ //
+ // ```dart
+ // int x = y;
+ // var y = x;
+ // ```
+ //
+ // Note, however, that while this code doesn't produce any diagnostics, it
+ // will produce a stack overflow at runtime unless at least one of the
+ // variables is assigned a value that doesn't depend on the other variables
+ // before any of the variables in the cycle are referenced.
static const CompileTimeErrorCode TOP_LEVEL_CYCLE = CompileTimeErrorCode(
'TOP_LEVEL_CYCLE',
"The type of '{0}' can't be inferred because it depends on itself "
@@ -11812,9 +12571,54 @@
correction: "Try using a type that is or is a subclass of '{1}'.");
/**
- * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type
- * available in the current lexical scope.
+ * No parameters.
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when the right-hand side of an `is`
+ // or `is!` test isn't a type.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the right-hand side is
+ // a parameter, not a type:
+ //
+ // ```dart
+ // typedef B = int Function(int);
+ //
+ // void f(Object a, B b) {
+ // if (a is [!b!]) {
+ // return;
+ // }
+ // }
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If you intended to use a type test, then replace the right-hand side with a
+ // type:
+ //
+ // ```dart
+ // typedef B = int Function(int);
+ //
+ // void f(Object a, B b) {
+ // if (a is B) {
+ // return;
+ // }
+ // }
+ // ```
+ //
+ // If you intended to use a different kind of test, then change the test:
+ //
+ // ```dart
+ // typedef B = int Function(int);
+ //
+ // void f(Object a, B b) {
+ // if (a == b) {
+ // return;
+ // }
+ // }
+ // ```
static const CompileTimeErrorCode TYPE_TEST_WITH_NON_TYPE =
CompileTimeErrorCode(
'TYPE_TEST_WITH_NON_TYPE',
@@ -12448,6 +13252,46 @@
* 0: the name of the operator that is undefined
* 1: the name of the extension that was explicitly specified
*/
+ // #### Description
+ //
+ // The analyzer produces this diagnostic when an operator is invoked on a
+ // specific extension when that extension doesn't implement the operator.
+ //
+ // #### Example
+ //
+ // The following code produces this diagnostic because the extension `E`
+ // doesn't define the operator `*`:
+ //
+ // ```dart
+ // var x = E('') [!*!] 4;
+ //
+ // extension E on String {}
+ // ```
+ //
+ // #### Common fixes
+ //
+ // If the extension is expected to implement the operator, then add an
+ // implementation of the operator to the extension:
+ //
+ // ```dart
+ // var x = E('') * 4;
+ //
+ // extension E on String {
+ // int operator *(int multiplier) => length * multiplier;
+ // }
+ // ```
+ //
+ // If the operator is defined by a different extension, then change the name
+ // of the extension to the name of the one that defines the operator.
+ //
+ // If the operator is defined on the argument of the extension override, then
+ // remove the extension override:
+ //
+ // ```dart
+ // var x = '' * 4;
+ //
+ // extension E on String {}
+ // ```
static const CompileTimeErrorCode UNDEFINED_EXTENSION_OPERATOR =
CompileTimeErrorCode('UNDEFINED_EXTENSION_OPERATOR',
"The operator '{0}' isn't defined for the extension '{1}'.",
diff --git a/pkg/analyzer/test/verify_diagnostics_test.dart b/pkg/analyzer/test/verify_diagnostics_test.dart
index c1c68c6..5b35e41 100644
--- a/pkg/analyzer/test/verify_diagnostics_test.dart
+++ b/pkg/analyzer/test/verify_diagnostics_test.dart
@@ -40,6 +40,8 @@
'CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE',
// Produces two diagnostics when it should only produce one.
'CompileTimeErrorCode.CONST_DEFERRED_CLASS',
+ // The mock SDK doesn't define any internal libraries.
+ 'CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY',
// Has code in the example section that needs to be skipped (because it's
// part of the explanitory text not part of the example), but there's
// currently no way to do that.
@@ -55,6 +57,8 @@
// No example, by design.
'CompileTimeErrorCode.MISSING_DART_LIBRARY',
// Produces two diagnostics when it should only produce one.
+ 'CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS',
+ // Produces two diagnostics when it should only produce one.
'CompileTimeErrorCode.NON_SYNC_FACTORY',
// Need a way to make auxiliary files that (a) are not included in the
// generated docs or (b) can be made persistent for fixes.
@@ -63,6 +67,12 @@
'CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT',
// Produces two diagnostic out of necessity.
'CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT',
+ // Produces two diagnostic out of necessity.
+ 'CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE',
+ // https://github.com/dart-lang/sdk/issues/45960
+ 'CompileTimeErrorCode.RETURN_IN_GENERATOR',
+ // Produces two diagnostic out of necessity.
+ 'CompileTimeErrorCode.TOP_LEVEL_CYCLE',
// Produces the diagnostic HintCode.UNUSED_LOCAL_VARIABLE when it shouldn't.
'CompileTimeErrorCode.UNDEFINED_IDENTIFIER_AWAIT',
// The code has been replaced but is not yet removed.
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index b13d301..44cee98 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -1327,28 +1327,6 @@
}
{% endprettify %}
-### built_in_identifier_as_extension_name
-
-_The built-in identifier '{0}' can't be used as an extension name._
-
-#### Description
-
-The analyzer produces this diagnostic when the name of an extension is a
-built-in identifier. Built-in identifiers can’t be used as extension names.
-
-#### Examples
-
-The following code produces this diagnostic because `mixin` is a built-in
-identifier:
-
-{% prettify dart tag=pre+code %}
-extension [!mixin!] on int {}
-{% endprettify %}
-
-#### Common fixes
-
-Choose a different name for the extension.
-
### built_in_identifier_as_type
_The built-in identifier '{0}' can't be used as a type._
@@ -1375,6 +1353,38 @@
List<int> x;
{% endprettify %}
+### built_in_identifier_in_declaration
+
+_The built-in identifier '{0}' can't be used as a prefix name._
+
+_The built-in identifier '{0}' can't be used as a type name._
+
+_The built-in identifier '{0}' can't be used as a type parameter name._
+
+_The built-in identifier '{0}' can't be used as a typedef name._
+
+_The built-in identifier '{0}' can't be used as an extension name._
+
+#### Description
+
+The analyzer produces this diagnostic when the name used in the declaration
+of a class, extension, mixin, typedef, type parameter, or import prefix is
+a built-in identifier. Built-in identifiers can’t be used to name any of
+these kinds of declarations.
+
+#### Example
+
+The following code produces this diagnostic because `mixin` is a built-in
+identifier:
+
+{% prettify dart tag=pre+code %}
+extension [!mixin!] on int {}
+{% endprettify %}
+
+#### Common fixes
+
+Choose a different name for the declaration.
+
### case_block_not_terminated
_The last statement of the 'case' should be 'break', 'continue', 'rethrow',
@@ -1707,6 +1717,47 @@
}
{% endprettify %}
+### conflicting_constructor_and_static_member
+
+_'{0}' can't be used to name both a constructor and a static field in this
+class._
+
+_'{0}' can't be used to name both a constructor and a static method in this
+class._
+
+#### Description
+
+The analyzer produces this diagnostic when a named constructor and either a
+static method or static field have the same name. Both are accessed using
+the name of the class, so having the same name makes the reference
+ambiguous.
+
+#### Example
+
+The following code produces this diagnostic because the static field `foo`
+and the named constructor `foo` have the same name:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C.[!foo!]();
+ static int foo = 0;
+}
+{% endprettify %}
+
+The following code produces this diagnostic because the static method `foo`
+and the named constructor `foo` have the same name:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C.[!foo!]();
+ static void foo() {}
+}
+{% endprettify %}
+
+#### Common fixes
+
+Rename either the member or the constructor.
+
### conflicting_generic_interfaces
_The class '{0}' can't implement both '{1}' and '{2}' because the type arguments
@@ -3113,6 +3164,42 @@
int y = 1;
{% endprettify %}
+### duplicate_field_formal_parameter
+
+_The field '{0}' can't be initialized by multiple parameters in the same
+constructor._
+
+#### Description
+
+The analyzer produces this diagnostic when there's more than one field
+formal parameter for the same field in a constructor's parameter list. It
+isn't useful to assign a value that will immediately be overwritten.
+
+#### Example
+
+The following code produces this diagnostic because `this.f` appears twice
+in the parameter list:
+
+{% prettify dart tag=pre+code %}
+class C {
+ int f;
+
+ C(this.f, this.[!f!]) {}
+}
+{% endprettify %}
+
+#### Common fixes
+
+Remove one of the field formal parameters:
+
+{% prettify dart tag=pre+code %}
+class C {
+ int f;
+
+ C(this.f) {}
+}
+{% endprettify %}
+
### duplicate_hidden_name
_Duplicate hidden name._
@@ -3597,6 +3684,28 @@
var m = <int, String>{};
{% endprettify %}
+### export_internal_library
+
+_The library '{0}' is internal and can't be exported._
+
+#### Description
+
+The analyzer produces this diagnostic when it finds an export whose `dart:`
+URI references an internal library.
+
+#### Example
+
+The following code produces this diagnostic because `_interceptors` is an
+internal library:
+
+{% prettify dart tag=pre+code %}
+export [!'dart:_interceptors'!];
+{% endprettify %}
+
+#### Common fixes
+
+Remove the export directive.
+
### export_legacy_symbol
_The symbol '{0}' is defined in a legacy library, and can't be re-exported from
@@ -5278,6 +5387,63 @@
}
{% endprettify %}
+### initializer_for_static_field
+
+_'{0}' is a static field in the enclosing class. Fields initialized in a
+constructor can't be static._
+
+#### Description
+
+The analyzer produces this diagnostic when a static field is initialized in
+a constructor using either a field formal parameter or an assignment in the
+initializer list.
+
+#### Example
+
+The following code produces this diagnostic because the static field `a` is
+being initialized by the field formal parameter `this.a`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ static int? a;
+ C([!this.a!]);
+}
+{% endprettify %}
+
+#### Common fixes
+
+If the field should be an instance field, then remove the keyword `static`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ int? a;
+ C(this.a);
+}
+{% endprettify %}
+
+If you intended to initialize an instance field and typed the wrong name,
+then correct the name of the field being initialized:
+
+{% prettify dart tag=pre+code %}
+class C {
+ static int? a;
+ int? b;
+ C(this.b);
+}
+{% endprettify %}
+
+If you really want to initialize the static field, then move the
+initialization into the constructor body:
+
+{% prettify dart tag=pre+code %}
+class C {
+ static int? a;
+ C(int? c) {
+ a = c;
+ }
+}
+{% endprettify %}
+
### initializing_formal_for_non_existent_field
_'{0}' isn't a field in the enclosing class._
@@ -6013,6 +6179,89 @@
var x;
{% endprettify %}
+### invalid_modifier_on_constructor
+
+_The modifier '{0}' can't be applied to the body of a constructor._
+
+#### Description
+
+The analyzer produces this diagnostic when the body of a constructor is
+prefixed by one of the following modifiers: `async`, `async*`, or `sync*`.
+Constructor bodies must be synchronous.
+
+#### Example
+
+The following code produces this diagnostic because the body of the
+constructor for `C` is marked as being `async`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C() [!async!] {}
+}
+{% endprettify %}
+
+#### Common fixes
+
+If the constructor can be synchronous, then remove the modifier:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C();
+}
+{% endprettify %}
+
+If the constructor can't be synchronous, then use a static method to create
+the instance instead:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C();
+ static Future<C> c() async {
+ return C();
+ }
+}
+{% endprettify %}
+
+### invalid_modifier_on_setter
+
+_The modifier '{0}' can't be applied to the body of a setter._
+
+#### Description
+
+The analyzer produces this diagnostic when the body of a setter is prefixed
+by one of the following modifiers: `async`, `async*`, or `sync*`. Setter
+bodies must be synchronous.
+
+#### Example
+
+The following code produces this diagnostic because the body of the setter
+`x` is marked as being `async`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ set x(int i) [!async!] {}
+}
+{% endprettify %}
+
+#### Common fixes
+
+If the setter can be synchronous, then remove the modifier:
+
+{% prettify dart tag=pre+code %}
+class C {
+ set x(int i) {}
+}
+{% endprettify %}
+
+If the setter can't be synchronous, then use a method to set the value
+instead:
+
+{% prettify dart tag=pre+code %}
+class C {
+ void x(int i) async {}
+}
+{% endprettify %}
+
### invalid_null_aware_operator
_The receiver can't be null because of short-circuiting, so the null-aware
@@ -7308,6 +7557,143 @@
Add a `return` statement that makes the return value explicit, even if
`null` is the appropriate value.
+### mixin_application_concrete_super_invoked_member_type
+
+_The super-invoked member '{0}' has the type '{1}', and the concrete member in
+the class has the type '{2}'._
+
+#### Description
+
+The analyzer produces this diagnostic when a mixin that invokes a method
+using `super` is used in a class where the concrete implementation of that
+method has a different signature than the signature defined for that method
+by the mixin's `on` type. The reason this is an error is because the
+invocation in the mixin might invoke the method in a way that's
+incompatible with the method that will actually be executed.
+
+#### Example
+
+The following code produces this diagnostic because the class `C` uses the
+mixin `M`, the mixin `M` invokes `foo` using `super`, and the abstract
+version of `foo` declared in `I` (the mixin's `on` type) doesn't have the
+same signature as the concrete version of `foo` declared in `A`:
+
+{% prettify dart tag=pre+code %}
+class I {
+ void foo([int? p]) {}
+}
+
+class A {
+ void foo(int p) {}
+}
+
+abstract class B extends A implements I {
+ @override
+ void foo([int? p]);
+}
+
+mixin M on I {
+ void bar() {
+ super.foo(42);
+ }
+}
+
+abstract class C extends B with [!M!] {}
+{% endprettify %}
+
+#### Common fixes
+
+If the class doesn't need to use the mixin, then remove it from the `with`
+clause:
+
+{% prettify dart tag=pre+code %}
+class I {
+ void foo([int? p]) {}
+}
+
+class A {
+ void foo(int? p) {}
+}
+
+abstract class B extends A implements I {
+ @override
+ void foo([int? p]);
+}
+
+mixin M on I {
+ void bar() {
+ super.foo(42);
+ }
+}
+
+abstract class C extends B {}
+{% endprettify %}
+
+If the class needs to use the mixin, then ensure that there's a concrete
+implementation of the method that conforms to the signature expected by the
+mixin:
+
+{% prettify dart tag=pre+code %}
+class I {
+ void foo([int? p]) {}
+}
+
+class A {
+ void foo(int? p) {}
+}
+
+abstract class B extends A implements I {
+ @override
+ void foo([int? p]) {
+ super.foo(p);
+ }
+}
+
+mixin M on I {
+ void bar() {
+ super.foo(42);
+ }
+}
+
+abstract class C extends B with M {}
+{% endprettify %}
+
+### mixin_application_not_implemented_interface
+
+_'{0}' can't be mixed onto '{1}' because '{1}' doesn't implement '{2}'._
+
+#### Description
+
+The analyzer produces this diagnostic when a mixin that has a superclass
+constraint is used in a [mixin application][] with a superclass that
+doesn't implement the required constraint.
+
+#### Example
+
+The following code produces this diagnostic because the mixin `M` requires
+isn't a subclass of `A`:
+
+{% prettify dart tag=pre+code %}
+class A {}
+
+mixin M on A {}
+
+class X = Object with [!M!];
+{% endprettify %}
+
+#### Common fixes
+
+If you need to use the mixin, then change the superclass to be either the
+same as or a subclass of the superclass constraint:
+
+{% prettify dart tag=pre+code %}
+class A {}
+
+mixin M on A {}
+
+class X = A with M;
+{% endprettify %}
+
### mixin_application_no_concrete_super_invoked_member
_The class doesn't have a concrete implementation of the super-invoked member
@@ -7381,6 +7767,120 @@
abstract class B extends A with M {}
{% endprettify %}
+### mixin_class_declares_constructor
+
+_The class '{0}' can't be used as a mixin because it declares a constructor._
+
+#### Description
+
+The analyzer produces this diagnostic when a class is used as a mixin and
+the mixed-in class defines a constructor.
+
+#### Example
+
+The following code produces this diagnostic because the class `A`, which
+defines a constructor, is being used as a mixin:
+
+{% prettify dart tag=pre+code %}
+class A {
+ A();
+}
+
+class B with [!A!] {}
+{% endprettify %}
+
+#### Common fixes
+
+If it's possible to convert the class to a mixin, then do so:
+
+{% prettify dart tag=pre+code %}
+mixin A {
+}
+
+class B with A {}
+{% endprettify %}
+
+If the class can't be a mixin and it's possible to remove the constructor,
+then do so:
+
+{% prettify dart tag=pre+code %}
+class A {
+}
+
+class B with A {}
+{% endprettify %}
+
+If the class can't be a mixin and you can't remove the constructor, then
+try extending or implementing the class rather than mixing it in:
+
+{% prettify dart tag=pre+code %}
+class A {
+ A();
+}
+
+class B extends A {}
+{% endprettify %}
+
+### mixin_inherits_from_not_object
+
+_The class '{0}' can't be used as a mixin because it extends a class other than
+'Object'._
+
+#### Description
+
+The analyzer produces this diagnostic when a class that extends a class
+other than `Object` is used as a mixin.
+
+#### Example
+
+The following code produces this diagnostic because the class `B`, which
+extends `A`, is being used as a mixin by `C`:
+
+{% prettify dart tag=pre+code %}
+class A {}
+
+class B extends A {}
+
+class C with [!B!] {}
+{% endprettify %}
+
+#### Common fixes
+
+If the class being used as a mixin can be changed to extend `Object`, then
+change it:
+
+{% prettify dart tag=pre+code %}
+class A {}
+
+class B {}
+
+class C with B {}
+{% endprettify %}
+
+If the class being used as a mixin can't be changed and the class that's
+using it extends `Object`, then extend the class being used as a mixin:
+
+{% prettify dart tag=pre+code %}
+class A {}
+
+class B extends A {}
+
+class C extends B {}
+{% endprettify %}
+
+If the class doesn't extend `Object` or if you want to be able to mix in
+the behavior from `B` in other places, then create a real mixin:
+
+{% prettify dart tag=pre+code %}
+class A {}
+
+mixin M on A {}
+
+class B extends A with M {}
+
+class C extends A with M {}
+{% endprettify %}
+
### mixin_instantiate
_Mixins can't be instantiated._
@@ -7501,6 +8001,92 @@
Otherwise, remove the type from the `on` clause.
+### multiple_super_initializers
+
+_A constructor can have at most one 'super' initializer._
+
+#### Description
+
+The analyzer produces this diagnostic when the initializer list of a
+constructor contains more than one invocation of a constructor from the
+superclass. The initializer list is required to have exactly one such call,
+which can either be explicit or implicit.
+
+#### Example
+
+The following code produces this diagnostic because the initializer list
+for `B`’s constructor invokes both the constructor `one` and the
+constructor `two` from the superclass `A`:
+
+{% prettify dart tag=pre+code %}
+class A {
+ int? x;
+ String? s;
+ A.one(this.x);
+ A.two(this.s);
+}
+
+class B extends A {
+ B() : super.one(0), [!super.two('')!];
+}
+{% endprettify %}
+
+#### Common fixes
+
+If one of the super constructors will initialize the instance fully, then
+remove the other:
+
+{% prettify dart tag=pre+code %}
+class A {
+ int? x;
+ String? s;
+ A.one(this.x);
+ A.two(this.s);
+}
+
+class B extends A {
+ B() : super.one(0);
+}
+{% endprettify %}
+
+If the initialization achieved by one of the super constructors can be
+performed in the body of the constructor, then remove its super invocation
+and perform the initialization in the body:
+
+{% prettify dart tag=pre+code %}
+class A {
+ int? x;
+ String? s;
+ A.one(this.x);
+ A.two(this.s);
+}
+
+class B extends A {
+ B() : super.one(0) {
+ s = '';
+ }
+}
+{% endprettify %}
+
+If the initialization can only be performed in a constructor in the
+superclass, then either add a new constructor or modify one of the existing
+constructors so there's a constructor that allows all the required
+initialization to occur in a single call:
+
+{% prettify dart tag=pre+code %}
+class A {
+ int? x;
+ String? s;
+ A.one(this.x);
+ A.two(this.s);
+ A.three(this.x, this.s);
+}
+
+class B extends A {
+ B() : super.three(0, '');
+}
+{% endprettify %}
+
### must_be_immutable
_This class (or a class that this class inherits from) is marked as
@@ -8337,6 +8923,51 @@
void f() => const C();
{% endprettify %}
+### non_generative_constructor
+
+_The generative constructor '{0}' is expected, but a factory was found._
+
+#### Description
+
+The analyzer produces this diagnostic when the initializer list of a
+constructor invokes a constructor from the superclass, and the invoked
+constructor is a factory constructor. Only a generative constructor can be
+invoked in the initializer list.
+
+#### Example
+
+The following code produces this diagnostic because the invocation of the
+constructor `super.one()` is invoking a factory constructor:
+
+{% prettify dart tag=pre+code %}
+class A {
+ factory A.one() = B;
+ A.two();
+}
+
+class B extends A {
+ B() : [!super.one()!];
+}
+{% endprettify %}
+
+#### Common fixes
+
+Change the super invocation to invoke a generative constructor:
+
+{% prettify dart tag=pre+code %}
+class A {
+ factory A.one() = B;
+ A.two();
+}
+
+class B extends A {
+ B() : super.two();
+}
+{% endprettify %}
+
+If the generative constructor is the unnamed constructor, and if there are
+no arguments being passed to it, then you can remove the super invocation.
+
### non_sync_factory
_Factory bodies can't use 'async', 'async*', or 'sync*'._
@@ -8454,6 +9085,66 @@
}
{% endprettify %}
+### non_void_return_for_operator
+
+_The return type of the operator []= must be 'void'._
+
+#### Description
+
+The analyzer produces this diagnostic when a declaration of the operator
+`[]=` has a return type other than `void`.
+
+#### Example
+
+The following code produces this diagnostic because the declaration of the
+operator `[]=` has a return type of `int`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ [!int!] operator []=(int index, int value) => 0;
+}
+{% endprettify %}
+
+#### Common fixes
+
+Change the return type to `void`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ void operator []=(int index, int value) => 0;
+}
+{% endprettify %}
+
+### non_void_return_for_setter
+
+_The return type of the setter must be 'void' or absent._
+
+#### Description
+
+The analyzer produces this diagnostic when a setter is defined with a
+return type other than `void`.
+
+#### Example
+
+The following code produces this diagnostic because the setter `p` has a
+return type of `int`:
+
+{% prettify dart tag=pre+code %}
+class C {
+ [!int!] set p(int i) => 0;
+}
+{% endprettify %}
+
+#### Common fixes
+
+Change the return type to `void` or omit the return type:
+
+{% prettify dart tag=pre+code %}
+class C {
+ set p(int i) => 0;
+}
+{% endprettify %}
+
### not_assigned_potentially_non_nullable_local_variable
_The non-nullable local variable '{0}' must be assigned before it can be used._
@@ -9133,6 +9824,36 @@
class B {}
{% endprettify %}
+### optional_parameter_in_operator
+
+_Optional parameters aren't allowed when defining an operator._
+
+#### Description
+
+The analyzer produces this diagnostic when one or more of the parameters in
+an operator declaration are optional.
+
+#### Example
+
+The following code produces this diagnostic because the parameter `other`
+is an optional parameter:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C operator +([[!C? other!]]) => this;
+}
+{% endprettify %}
+
+#### Common fixes
+
+Make all of the parameters be required parameters:
+
+{% prettify dart tag=pre+code %}
+class C {
+ C operator +(C other) => this;
+}
+{% endprettify %}
+
### override_on_non_overriding_member
_The field doesn't override an inherited getter or setter._
@@ -9255,6 +9976,43 @@
import 'a.dart';
{% endprettify %}
+### part_of_unnamed_library
+
+_The library is unnamed. A URI is expected, not a library name '{0}', in the
+part-of directive._
+
+#### Description
+
+The analyzer produces this diagnostic when a library that doesn't have a
+`library` directive (and hence has no name) contains a `part` directive and
+the `part of` directive in the part file uses a name to specify the library
+that it's a part of.
+
+#### Example
+
+Given a part file named `part_file.dart` containing the following code:
+
+{% prettify dart tag=pre+code %}
+part of lib;
+{% endprettify %}
+
+The following code produces this diagnostic because the library including
+the part file doesn't have a name even though the part file uses a name to
+specify which library it's a part of:
+
+{% prettify dart tag=pre+code %}
+part [!'part_file.dart'!];
+{% endprettify %}
+
+#### Common fixes
+
+Change the `part of` directive in the part file to specify its library by
+URI:
+
+{% prettify dart tag=pre+code %}
+part of 'test.dart';
+{% endprettify %}
+
### prefix_collides_with_top_level_member
_The name '{0}' is already used as an import prefix and can't be used to name a
@@ -9483,6 +10241,38 @@
}
{% endprettify %}
+### recursive_interface_inheritance
+
+_'{0}' can't be a superinterface of itself: {1}._
+
+_'{0}' can't extend itself._
+
+_'{0}' can't implement itself._
+
+_'{0}' can't use itself as a mixin._
+
+_'{0}' can't use itself as a superclass constraint._
+
+#### Description
+
+The analyzer produces this diagnostic when there's a circularity in the
+type hierarchy. This happens when a type, either directly or indirectly,
+is declared to be a subtype of itself.
+
+#### Example
+
+The following code produces this diagnostic because the class `A` is
+declared to be a subtype of `B`, and `B` is a subtype of `A`:
+
+{% prettify dart tag=pre+code %}
+class [!A!] extends B {}
+class B implements A {}
+{% endprettify %}
+
+#### Common fixes
+
+Change the type hierarchy so that there's no circularity.
+
### redirect_generative_to_missing_constructor
_The constructor '{0}' couldn't be found in '{1}'._
@@ -9924,6 +10714,48 @@
}
{% endprettify %}
+### return_in_generator
+
+_Can't return a value from a generator function (using the '{0}' modifier)._
+
+#### Description
+
+The analyzer produces this diagnostic when a generator function (one whose
+body is marked with either `async*` or `sync*`) uses a `return` statement
+to return a value. In both cases, they should use `yield` instead of
+`return`.
+
+#### Example
+
+The following code produces this diagnostic because the method `f` is a
+generator and is using `return` to return a value:
+
+{% prettify dart tag=pre+code %}
+Iterable<int> f() sync* {
+ [!return 3!];
+}
+{% endprettify %}
+
+#### Common fixes
+
+If the method is intended to be a generator, then use `yield` to return a
+value:
+
+{% prettify dart tag=pre+code %}
+Iterable<int> f() sync* {
+ yield 3;
+}
+{% endprettify %}
+
+If the method isn't intended to be a generator, then remove the modifier
+from the body (or use `async` if you're returning a future):
+
+{% prettify dart tag=pre+code %}
+int f() {
+ return 3;
+}
+{% endprettify %}
+
### return_of_invalid_type
_A value of type '{0}' can't be returned from the constructor '{2}' because it
@@ -10539,6 +11371,40 @@
var b = [...a];
{% endprettify %}
+### set_element_type_not_assignable
+
+_The element type '{0}' can't be assigned to the set type '{1}'._
+
+#### Description
+
+The analyzer produces this diagnostic when an element in a set literal has
+a type that isn't assignable to the element type of the set.
+
+#### Example
+
+The following code produces this diagnostic because the type of the string
+literal `'0'` is `String`, which isn't assignable to `int`, the element
+type of the set:
+
+{% prettify dart tag=pre+code %}
+var s = <int>{[!'0'!]};
+{% endprettify %}
+
+#### Common fixes
+
+If the element type of the set literal is wrong, then change the element
+type of the set:
+
+{% prettify dart tag=pre+code %}
+var s = <String>{'0'};
+{% endprettify %}
+
+If the type of the element is wrong, then change the element:
+
+{% prettify dart tag=pre+code %}
+var s = <int>{'0'.length};
+{% endprettify %}
+
### shared_deferred_prefix
_The prefix of a deferred import can't be used in other import directives._
@@ -10745,6 +11611,45 @@
class B {}
{% endprettify %}
+### supertype_expands_to_type_parameter
+
+_A type alias that expands to a type parameter can't be implemented._
+
+_A type alias that expands to a type parameter can't be mixed in._
+
+_A type alias that expands to a type parameter can't be used as a superclass
+constraint._
+
+_A type alias that expands to a type parameter can't be used as a superclass._
+
+#### Description
+
+The analyzer produces this diagnostic when a type alias that expands to a
+type parameter is used in an `extends`, `implements`, `with`, or `on`
+clause.
+
+#### Example
+
+The following code produces this diagnostic because the type alias `T`,
+which expands to the type parameter `S`, is used in the `extends` clause of
+the class `C`:
+
+{% prettify dart tag=pre+code %}
+typedef T<S> = S;
+
+class C extends [!T!]<Object> {}
+{% endprettify %}
+
+#### Common fixes
+
+Use the value of the type argument directly:
+
+{% prettify dart tag=pre+code %}
+typedef T<S> = S;
+
+class C extends Object {}
+{% endprettify %}
+
### super_in_extension
_The 'super' keyword can't be used in an extension because an extension doesn't
@@ -10917,6 +11822,51 @@
}
{% endprettify %}
+### top_level_cycle
+
+_The type of '{0}' can't be inferred because it depends on itself through the
+cycle: {1}._
+
+#### Description
+
+The analyzer produces this diagnostic when a top-level variable has no type
+annotation and the variable's initializer refers to the variable, either
+directly or indirectly.
+
+#### Example
+
+The following code produces this diagnostic because the variables `x` and
+`y` are defined in terms of each other, and neither has an explicit type,
+so the type of the other can't be inferred:
+
+{% prettify dart tag=pre+code %}
+var x = y;
+var y = [!x!];
+{% endprettify %}
+
+#### Common fixes
+
+If the two variables don't need to refer to each other, then break the
+cycle:
+
+{% prettify dart tag=pre+code %}
+var x = 0;
+var y = x;
+{% endprettify %}
+
+If the two variables need to refer to each other, then give at least one of
+them an explicit type:
+
+{% prettify dart tag=pre+code %}
+int x = y;
+var y = x;
+{% endprettify %}
+
+Note, however, that while this code doesn't produce any diagnostics, it
+will produce a stack overflow at runtime unless at least one of the
+variables is assigned a value that doesn't depend on the other variables
+before any of the variables in the cycle are referenced.
+
### type_annotation_deferred_class
_The deferred type '{0}' can't be used in a declaration, cast, or type test._
@@ -11029,6 +11979,57 @@
Note, however, that there isn’t a relationship between `T` and `S`, so this
second option changes the semantics from what was likely to be intended.
+### type_test_with_non_type
+
+_The name '{0}' isn't a type and can't be used in an 'is' expression._
+
+#### Description
+
+The analyzer produces this diagnostic when the right-hand side of an `is`
+or `is!` test isn't a type.
+
+#### Example
+
+The following code produces this diagnostic because the right-hand side is
+a parameter, not a type:
+
+{% prettify dart tag=pre+code %}
+typedef B = int Function(int);
+
+void f(Object a, B b) {
+ if (a is [!b!]) {
+ return;
+ }
+}
+{% endprettify %}
+
+#### Common fixes
+
+If you intended to use a type test, then replace the right-hand side with a
+type:
+
+{% prettify dart tag=pre+code %}
+typedef B = int Function(int);
+
+void f(Object a, B b) {
+ if (a is B) {
+ return;
+ }
+}
+{% endprettify %}
+
+If you intended to use a different kind of test, then change the test:
+
+{% prettify dart tag=pre+code %}
+typedef B = int Function(int);
+
+void f(Object a, B b) {
+ if (a == b) {
+ return;
+ }
+}
+{% endprettify %}
+
### type_test_with_undefined_name
_The name '{0}' isn't defined, so it can't be used in an 'is' expression._
@@ -11510,6 +12511,51 @@
}
{% endprettify %}
+### undefined_extension_operator
+
+_The operator '{0}' isn't defined for the extension '{1}'._
+
+#### Description
+
+The analyzer produces this diagnostic when an operator is invoked on a
+specific extension when that extension doesn't implement the operator.
+
+#### Example
+
+The following code produces this diagnostic because the extension `E`
+doesn't define the operator `*`:
+
+{% prettify dart tag=pre+code %}
+var x = E('') [!*!] 4;
+
+extension E on String {}
+{% endprettify %}
+
+#### Common fixes
+
+If the extension is expected to implement the operator, then add an
+implementation of the operator to the extension:
+
+{% prettify dart tag=pre+code %}
+var x = E('') * 4;
+
+extension E on String {
+ int operator *(int multiplier) => length * multiplier;
+}
+{% endprettify %}
+
+If the operator is defined by a different extension, then change the name
+of the extension to the name of the one that defines the operator.
+
+If the operator is defined on the argument of the extension override, then
+remove the extension override:
+
+{% prettify dart tag=pre+code %}
+var x = '' * 4;
+
+extension E on String {}
+{% endprettify %}
+
### undefined_extension_setter
_The setter '{0}' isn't defined for the extension '{1}'._
diff --git a/pkg/js_ast/lib/src/builder.dart b/pkg/js_ast/lib/src/builder.dart
index 2fee946..d741180 100644
--- a/pkg/js_ast/lib/src/builder.dart
+++ b/pkg/js_ast/lib/src/builder.dart
@@ -736,7 +736,7 @@
'/': 5,
'%': 5
};
- static final UNARY_OPERATORS = [
+ static final UNARY_OPERATORS = {
'++',
'--',
'+',
@@ -747,10 +747,16 @@
'void',
'delete',
'await'
- ].toSet();
+ };
- static final OPERATORS_THAT_LOOK_LIKE_IDENTIFIERS =
- ['typeof', 'void', 'delete', 'in', 'instanceof', 'await'].toSet();
+ static final OPERATORS_THAT_LOOK_LIKE_IDENTIFIERS = {
+ 'typeof',
+ 'void',
+ 'delete',
+ 'in',
+ 'instanceof',
+ 'await'
+ };
static int category(int code) {
if (code >= CATEGORIES.length) return OTHER;
diff --git a/pkg/js_ast/pubspec.yaml b/pkg/js_ast/pubspec.yaml
index 7909c53..c510415 100644
--- a/pkg/js_ast/pubspec.yaml
+++ b/pkg/js_ast/pubspec.yaml
@@ -3,7 +3,7 @@
publish_to: none
environment:
- sdk: '>=2.0.0 <3.0.0'
+ sdk: '>=2.10.0 <3.0.0'
dev_dependencies:
expect:
diff --git a/pkg/js_ast/test/printer_callback_test.dart b/pkg/js_ast/test/printer_callback_test.dart
index 7d8fb30..153c41d 100644
--- a/pkg/js_ast/test/printer_callback_test.dart
+++ b/pkg/js_ast/test/printer_callback_test.dart
@@ -170,9 +170,6 @@
String get key => name;
FixedName(this.name);
-
- @override
- int compareTo(other) => 0;
}
void check(TestCase testCase) {
diff --git a/tools/VERSION b/tools/VERSION
index ea67459..f2c3675 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 142
+PRERELEASE 143
PRERELEASE_PATCH 0
\ No newline at end of file