Version 2.14.0-73.0.dev
Merge commit '11831f4e016eba72fa33b65c78bb295f3e56d1d0' into 'dev'
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index b72acd8..c384626 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -217,7 +217,6 @@
CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD,
CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD,
- CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD,
CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY,
CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC,
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 2ca44d5..9c8e2f7 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -5638,8 +5638,6 @@
* Parameters:
* 0: the name of the initializing formal that is a static variable in the
* immediately enclosing class
- *
- * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD].
*/
static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD =
CompileTimeErrorCode(
@@ -5731,24 +5729,6 @@
hasPublishedDocs: true);
/**
- * 7.6.1 Generative Constructors: An initializing formal has the form
- * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of
- * an instance variable of the immediately enclosing class.
- *
- * Parameters:
- * 0: the name of the initializing formal that is a static variable in the
- * immediately enclosing class
- *
- * See [INITIALIZER_FOR_STATIC_FIELD].
- */
- static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD =
- CompileTimeErrorCode(
- 'INITIALIZING_FORMAL_FOR_STATIC_FIELD',
- "'{0}' is a static field in the enclosing class. Fields initialized "
- "in a constructor can't be static.",
- correction: "Try removing the initialization.");
-
- /**
* Parameters:
* 0: the name of the static member
* 1: the kind of the static member (field, getter, setter, or method)
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 3e45b52..d7a2feb 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -4272,7 +4272,7 @@
[parameter.identifier.name]);
} else if (fieldElement.isStatic) {
errorReporter.reportErrorForNode(
- CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD,
+ CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
parameter,
[parameter.identifier.name]);
} else if (!typeSystem.isSubtypeOf(declaredType, fieldType)) {
@@ -4289,7 +4289,7 @@
[parameter.identifier.name]);
} else if (fieldElement.isStatic) {
errorReporter.reportErrorForNode(
- CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD,
+ CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
parameter,
[parameter.identifier.name]);
}
diff --git a/pkg/analyzer/test/src/diagnostics/initializer_for_static_field_test.dart b/pkg/analyzer/test/src/diagnostics/initializer_for_static_field_test.dart
index 35dd54c..6acd087 100644
--- a/pkg/analyzer/test/src/diagnostics/initializer_for_static_field_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/initializer_for_static_field_test.dart
@@ -15,7 +15,18 @@
@reflectiveTest
class InitializerForStaticFieldTest extends PubPackageResolutionTest {
- test_static() async {
+ test_fieldFormalParameter() async {
+ await assertErrorsInCode(r'''
+class A {
+ static int? x;
+ A([this.x = 0]) {}
+}
+''', [
+ error(CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD, 32, 6),
+ ]);
+ }
+
+ test_initializer() async {
await assertErrorsInCode(r'''
class A {
static int x = 1;
diff --git a/pkg/analyzer/test/src/diagnostics/initializing_formal_for_static_field_test.dart b/pkg/analyzer/test/src/diagnostics/initializing_formal_for_static_field_test.dart
deleted file mode 100644
index 78471ac..0000000
--- a/pkg/analyzer/test/src/diagnostics/initializing_formal_for_static_field_test.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/src/error/codes.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/context_collection_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(InitializingFormalForStaticFieldTest);
- });
-}
-
-@reflectiveTest
-class InitializingFormalForStaticFieldTest extends PubPackageResolutionTest {
- test_static() async {
- await assertErrorsInCode(r'''
-class A {
- static int? x;
- A([this.x = 0]) {}
-}
-''', [
- error(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, 32, 6),
- ]);
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 46d80bd..29b0461 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -265,8 +265,6 @@
import 'initializer_for_static_field_test.dart' as initializer_for_static_field;
import 'initializing_formal_for_non_existent_field_test.dart'
as initializing_formal_for_non_existent_field;
-import 'initializing_formal_for_static_field_test.dart'
- as initializing_formal_for_static_field;
import 'instance_access_to_static_member_test.dart'
as instance_access_to_static_member;
import 'instance_member_access_from_factory_test.dart'
@@ -860,7 +858,6 @@
initializer_for_non_existent_field.main();
initializer_for_static_field.main();
initializing_formal_for_non_existent_field.main();
- initializing_formal_for_static_field.main();
instance_access_to_static_member.main();
instance_member_access_from_factory.main();
instance_member_access_from_static.main();
diff --git a/tools/VERSION b/tools/VERSION
index 811a318..5eccd6f 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 72
+PRERELEASE 73
PRERELEASE_PATCH 0
\ No newline at end of file