Version 2.14.0-218.0.dev

Merge commit 'b14e5ed3555d4000d960addcec9932882bd972e3' into 'dev'
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index d9d2a5c..66cfda4 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -82,7 +82,7 @@
 /// TODO(scheglov) Clean up the list of implicitly analyzed files.
 class AnalysisDriver implements AnalysisDriverGeneric {
   /// The version of data format, should be incremented on every format change.
-  static const int DATA_VERSION = 157;
+  static const int DATA_VERSION = 158;
 
   /// The number of exception contexts allowed to write. Once this field is
   /// zero, we stop writing any new exception contexts in this process.
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart
index e79d895..25c9b9a 100644
--- a/pkg/analyzer/lib/src/summary2/element_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -50,7 +50,7 @@
   Linker get _linker => _libraryBuilder.linker;
 
   void buildDeclarationElements(CompilationUnit unit) {
-    unit.declarations.accept(this);
+    _visitPropertyFirst<TopLevelVariableDeclaration>(unit.declarations);
     _unitElement.accessors = _enclosingContext.propertyAccessors;
     _unitElement.classes = _enclosingContext.classes;
     _unitElement.enums = _enclosingContext.enums;
@@ -767,7 +767,6 @@
     }
 
     element.hasImplicitType = node.type == null;
-    element.isConst = node.isConst;
     element.isExplicitlyCovariant = node.covariantKeyword != null;
     element.isFinal = node.isFinal;
     element.metadata = _buildAnnotations(node.metadata);
@@ -884,21 +883,7 @@
     var holder = _EnclosingContext(element.reference!, element,
         hasConstConstructor: hasConstConstructor);
     _withEnclosing(holder, () {
-      // When loading from bytes, we read fields first.
-      // There is no particular reason for this - we just have to store
-      // either non-synthetic fields first, or non-synthetic property
-      // accessors first. And we arbitrary decided to store fields first.
-      for (var member in members) {
-        if (member is FieldDeclaration) {
-          member.accept(this);
-        }
-      }
-      // ...then we load non-synthetic accessors.
-      for (var member in members) {
-        if (member is! FieldDeclaration) {
-          member.accept(this);
-        }
-      }
+      _visitPropertyFirst<FieldDeclaration>(members);
     });
     return holder;
   }
@@ -1036,6 +1021,25 @@
         fields.isFinal && _enclosingContext.hasConstConstructor;
   }
 
+  void _visitPropertyFirst<T extends AstNode>(List<AstNode> nodes) {
+    // When loading from bytes, we read fields first.
+    // There is no particular reason for this - we just have to store
+    // either non-synthetic fields first, or non-synthetic property
+    // accessors first. And we arbitrary decided to store fields first.
+    for (var node in nodes) {
+      if (node is T) {
+        node.accept(this);
+      }
+    }
+
+    // ...then we load non-synthetic accessors.
+    for (var node in nodes) {
+      if (node is! T) {
+        node.accept(this);
+      }
+    }
+  }
+
   /// Make the given [context] be the current one while running [f].
   void _withEnclosing(_EnclosingContext context, void Function() f) {
     var previousContext = _enclosingContext;
diff --git a/pkg/analyzer/test/src/summary/element_text.dart b/pkg/analyzer/test/src/summary/element_text.dart
index d0de517..2ddaa30 100644
--- a/pkg/analyzer/test/src/summary/element_text.dart
+++ b/pkg/analyzer/test/src/summary/element_text.dart
@@ -618,6 +618,7 @@
         buffer.write('optionalNamed ');
       }
 
+      _writeIf(e.isConst, 'const ');
       _writeIf(e.isCovariant, 'covariant ');
       _writeIf(e.isFinal, 'final ');
 
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 0cf4788..e33cc31 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -16345,6 +16345,22 @@
     expect(f.hasImplicitReturnType, isTrue);
   }
 
+  test_function_parameter_const() async {
+    var library = await checkLibrary('''
+void f(const x) {}
+''');
+    checkElementText(library, r'''
+library
+  definingUnit
+    functions
+      f @5
+        parameters
+          requiredPositional x @13
+            type: dynamic
+        returnType: void
+''');
+  }
+
   test_function_parameter_fieldFormal() async {
     var library = await checkLibrary('''
 void f(int this.a) {}
diff --git a/pkg/front_end/testcases/general/issue41252.dart b/pkg/front_end/testcases/general/issue41252.dart
new file mode 100644
index 0000000..0733d7f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue41252.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2021, 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.
+
+class A {
+  static final int X = 0;
+  static final int X = 0;
+
+  static final int foo = X + 1;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue41252.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue41252.dart.textual_outline.expect
new file mode 100644
index 0000000..e72534b
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue41252.dart.textual_outline.expect
@@ -0,0 +1,7 @@
+class A {
+  static final int X = 0;
+  static final int X = 0;
+  static final int foo = X + 1;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue41252.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue41252.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..e72534b
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue41252.dart.textual_outline_modelled.expect
@@ -0,0 +1,7 @@
+class A {
+  static final int X = 0;
+  static final int X = 0;
+  static final int foo = X + 1;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue41252.dart.weak.expect b/pkg/front_end/testcases/general/issue41252.dart.weak.expect
new file mode 100644
index 0000000..2d3e1e5
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue41252.dart.weak.expect
@@ -0,0 +1,28 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue41252.dart:7:20: Error: 'X' is already declared in this scope.
+//   static final int X = 0;
+//                    ^
+// pkg/front_end/testcases/general/issue41252.dart:6:20: Context: Previous declaration of 'X'.
+//   static final int X = 0;
+//                    ^
+//
+// pkg/front_end/testcases/general/issue41252.dart:9:26: Error: Can't use 'X' because it is declared more than once.
+//   static final int foo = X + 1;
+//                          ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+  static final field core::int X = null;
+  static final field core::int foo = invalid-expression "pkg/front_end/testcases/general/issue41252.dart:9:26: Error: Can't use 'X' because it is declared more than once.
+  static final int foo = X + 1;
+                         ^"{dynamic}.+(1) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+  synthetic constructor •() → self::A
+    : super core::Object::•()
+    ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue41252.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue41252.dart.weak.outline.expect
new file mode 100644
index 0000000..e0f606e
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue41252.dart.weak.outline.expect
@@ -0,0 +1,22 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue41252.dart:7:20: Error: 'X' is already declared in this scope.
+//   static final int X = 0;
+//                    ^
+// pkg/front_end/testcases/general/issue41252.dart:6:20: Context: Previous declaration of 'X'.
+//   static final int X = 0;
+//                    ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+  static final field core::int X;
+  static final field core::int foo;
+  synthetic constructor •() → self::A
+    ;
+}
+static method main() → dynamic
+  ;
diff --git a/pkg/front_end/testcases/general/issue41252.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue41252.dart.weak.transformed.expect
new file mode 100644
index 0000000..2d3e1e5
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue41252.dart.weak.transformed.expect
@@ -0,0 +1,28 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue41252.dart:7:20: Error: 'X' is already declared in this scope.
+//   static final int X = 0;
+//                    ^
+// pkg/front_end/testcases/general/issue41252.dart:6:20: Context: Previous declaration of 'X'.
+//   static final int X = 0;
+//                    ^
+//
+// pkg/front_end/testcases/general/issue41252.dart:9:26: Error: Can't use 'X' because it is declared more than once.
+//   static final int foo = X + 1;
+//                          ^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+  static final field core::int X = null;
+  static final field core::int foo = invalid-expression "pkg/front_end/testcases/general/issue41252.dart:9:26: Error: Can't use 'X' because it is declared more than once.
+  static final int foo = X + 1;
+                         ^"{dynamic}.+(1) as{TypeError,ForDynamic,ForNonNullableByDefault} core::int;
+  synthetic constructor •() → self::A
+    : super core::Object::•()
+    ;
+}
+static method main() → dynamic {}
diff --git a/pkg/test_runner/lib/src/test_file.dart b/pkg/test_runner/lib/src/test_file.dart
index 7b92bc9..76faa68 100644
--- a/pkg/test_runner/lib/src/test_file.dart
+++ b/pkg/test_runner/lib/src/test_file.dart
@@ -7,11 +7,7 @@
 import 'path.dart';
 import 'static_error.dart';
 
-// TODO(rnystrom): Remove support for "///" once tests have been migrated.
-// https://dart-review.googlesource.com/c/sdk/+/106201
-// https://github.com/dart-lang/co19/issues/391
-/// Require at least one non-space character before '//[/#]'.
-final _multitestRegExp = RegExp(r"\S *//[#/] \w+:(.*)");
+final _multitestRegExp = RegExp(r"//# \w+:(.*)");
 
 final _vmOptionsRegExp = RegExp(r"// VMOptions=(.*)");
 final _environmentRegExp = RegExp(r"// Environment=(.*)");
diff --git a/sdk/lib/io/security_context.dart b/sdk/lib/io/security_context.dart
index 953d1e6..d041975 100644
--- a/sdk/lib/io/security_context.dart
+++ b/sdk/lib/io/security_context.dart
@@ -69,8 +69,8 @@
   /// of bytes.
   void usePrivateKeyBytes(List<int> keyBytes, {String? password});
 
-  /// Sets the set of trusted X509 certificates used by [SecureSocket]
-  /// client connections, when connecting to a secure server.
+  /// Add a certificate to the set of trusted X509 certificates
+  /// used by [SecureSocket] client connections.
   ///
   /// [file] is the path to a PEM or PKCS12 file containing X509 certificates,
   /// usually root certificates from certificate authorities. For PKCS12 files,
@@ -90,8 +90,8 @@
   /// ```
   void setTrustedCertificates(String file, {String? password});
 
-  /// Sets the set of trusted X509 certificates used by [SecureSocket]
-  /// client connections, when connecting to a secure server.
+  /// Add a certificate to the set of trusted X509 certificates
+  /// used by [SecureSocket] client connections.
   ///
   /// Like [setTrustedCertificates] but takes the contents of the file.
   void setTrustedCertificatesBytes(List<int> certBytes, {String? password});
diff --git a/tools/VERSION b/tools/VERSION
index 5632a42..a3d2d42 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 14
 PATCH 0
-PRERELEASE 217
+PRERELEASE 218
 PRERELEASE_PATCH 0
\ No newline at end of file