Version 2.13.0-108.0.dev

Merge commit 'b6001547ff1f3ee0fe6279e6bac8cdef9b9993e5' into 'dev'
diff --git a/pkg/compiler/lib/src/inferrer/builder_kernel.dart b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
index fc818c1..17d63df 100644
--- a/pkg/compiler/lib/src/inferrer/builder_kernel.dart
+++ b/pkg/compiler/lib/src/inferrer/builder_kernel.dart
@@ -492,8 +492,7 @@
     return null;
   }
 
-  @override
-  visitAssertStatement(ir.AssertStatement node) {
+  TypeInformation _handleAssertStatement(ir.AssertStatement node) {
     // Avoid pollution from assert statement unless enabled.
     if (!_options.enableUserAssertions) {
       return null;
@@ -514,6 +513,16 @@
   }
 
   @override
+  visitAssertInitializer(ir.AssertInitializer node) {
+    return _handleAssertStatement(node.statement);
+  }
+
+  @override
+  visitAssertStatement(ir.AssertStatement node) {
+    return _handleAssertStatement(node);
+  }
+
+  @override
   visitBreakStatement(ir.BreakStatement node) {
     JumpTarget target = _localsMap.getJumpTargetForBreak(node);
     _state.seenBreakOrContinue = true;
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 75156d4..ef086e0 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -1047,8 +1047,7 @@
         // TODO(sra): Apply inferred type information.
         _letBindings[variable] = value;
       } else if (initializer is ir.AssertInitializer) {
-        // Assert in initializer is currently not supported in dart2js.
-        // TODO(johnniwinther): Support assert in initializer.
+        initializer.statement.accept(this);
       } else if (initializer is ir.InvalidInitializer) {
         assert(false, 'ir.InvalidInitializer not handled');
       } else {
diff --git a/pkg/compiler/test/inference/data/assert_initializer.dart b/pkg/compiler/test/inference/data/assert_initializer.dart
new file mode 100644
index 0000000..9daf511
--- /dev/null
+++ b/pkg/compiler/test/inference/data/assert_initializer.dart
@@ -0,0 +1,23 @@
+// 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 X {
+  /*member: X.a:Union([exact=JSExtendableArray], [exact=JSString])*/
+  final dynamic a;
+
+  /*member: X.:[exact=X]*/
+  X(Object /*Union([exact=JSExtendableArray], [exact=JSString])*/ value)
+      : assert(value is String),
+        a = value;
+}
+
+/*member: main:[null]*/
+main() {
+  X('a')
+      . /*[exact=X]*/ a
+      . /*Union([exact=JSExtendableArray], [exact=JSString])*/ length;
+  X([1])
+      . /*[exact=X]*/ a
+      . /*Union([exact=JSExtendableArray], [exact=JSString])*/ length;
+}
diff --git a/pkg/compiler/test/inference/data/assert_initializer_ea.dart b/pkg/compiler/test/inference/data/assert_initializer_ea.dart
new file mode 100644
index 0000000..bf7f4f1
--- /dev/null
+++ b/pkg/compiler/test/inference/data/assert_initializer_ea.dart
@@ -0,0 +1,19 @@
+// 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 X {
+  /*member: X.a:[exact=JSString]*/
+  final dynamic a;
+
+  /*member: X.:[exact=X]*/
+  X(Object /*Union([exact=JSExtendableArray], [exact=JSString])*/ value)
+      : assert(value is String),
+        a = value;
+}
+
+/*member: main:[null]*/
+main() {
+  X('a'). /*[exact=X]*/ a. /*[exact=JSString]*/ length;
+  X([1]). /*[exact=X]*/ a. /*[exact=JSString]*/ length;
+}
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart
index 296d654..d537160 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart
@@ -795,9 +795,12 @@
         _invocation = null;
 
   @patch
-  NoSuchMethodError.withInvocation(Object? receiver, Invocation invocation)
-      : _receiver = receiver,
-        _memberName = invocation.memberName,
+  factory NoSuchMethodError.withInvocation(
+          Object? receiver, Invocation invocation) =
+      NoSuchMethodError._withInvocation;
+
+  NoSuchMethodError._withInvocation(this._receiver, Invocation invocation)
+      : _memberName = invocation.memberName,
         _arguments = invocation.positionalArguments,
         _namedArguments = invocation.namedArguments,
         _invocation = invocation;
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 1cd3bc4..8143db0 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -679,9 +679,10 @@
   final List? _existingArgumentNames;
 
   @patch
-  NoSuchMethodError.withInvocation(Object? receiver, Invocation invocation)
-      : this(receiver, invocation.memberName, invocation.positionalArguments,
-            invocation.namedArguments);
+  factory NoSuchMethodError.withInvocation(
+          Object? receiver, Invocation invocation) =>
+      NoSuchMethodError(receiver, invocation.memberName,
+          invocation.positionalArguments, invocation.namedArguments);
 
   @patch
   NoSuchMethodError(Object? receiver, Symbol memberName,
diff --git a/sdk/lib/_internal/vm/lib/errors_patch.dart b/sdk/lib/_internal/vm/lib/errors_patch.dart
index a33b803..3de48d4 100644
--- a/sdk/lib/_internal/vm/lib/errors_patch.dart
+++ b/sdk/lib/_internal/vm/lib/errors_patch.dart
@@ -189,9 +189,11 @@
   final Invocation _invocation;
 
   @patch
-  NoSuchMethodError.withInvocation(Object? receiver, Invocation invocation)
-      : _receiver = receiver,
-        _invocation = invocation;
+  factory NoSuchMethodError.withInvocation(
+          Object? receiver, Invocation invocation) =
+      NoSuchMethodError._withInvocation;
+
+  NoSuchMethodError._withInvocation(this._receiver, this._invocation);
 
   static void _throwNewInvocation(Object? receiver, Invocation invocation) {
     throw new NoSuchMethodError.withInvocation(receiver, invocation);
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 61aa5e3..080595a 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -448,13 +448,14 @@
 
 /// Error thrown by the default implementation of `noSuchMethod` on [Object].
 class NoSuchMethodError extends Error {
-  /// Create a [NoSuchMethodError] corresponding to a failed method call.
+  /// Creates a [NoSuchMethodError] corresponding to a failed method call.
   ///
   /// The [receiver] is the receiver of the method call.
   /// That is, the object on which the method was attempted called.
   ///
-  /// The [invocation] represents the method call that failed.
-  external NoSuchMethodError.withInvocation(
+  /// The [invocation] represents the method call that failed. It
+  /// should not be `null`.
+  external factory NoSuchMethodError.withInvocation(
       Object? receiver, Invocation invocation);
 
   // Deprecated constructor to be removed after dart2js updates to the above.
diff --git a/tests/language/assert/initializer_test.dart b/tests/language/assert/initializer_test.dart
index b5de1eb..7e8f486 100644
--- a/tests/language/assert/initializer_test.dart
+++ b/tests/language/assert/initializer_test.dart
@@ -2,6 +2,9 @@
 // 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.
 
+// VMOptions=--enable-asserts
+// dart2jsOptions=--enable-asserts
+
 // Dart test program testing assert statements.
 
 import "package:expect/expect.dart";
diff --git a/tools/VERSION b/tools/VERSION
index 0af9dd2..5f3c950 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 13
 PATCH 0
-PRERELEASE 107
+PRERELEASE 108
 PRERELEASE_PATCH 0
\ No newline at end of file