Version 2.12.0-55.0.dev

Merge commit 'd0a23d81066847eebe716f030910a22ea21000bf' into 'dev'
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index 61f26ab..082445b 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -571,8 +571,8 @@
   }
 
   test_unusedFiles() async {
-    var bPath = '/workspace/dart/aaa/lib/b.dart';
-    var cPath = '/workspace/dart/aaa/lib/c.dart';
+    var bPath = convertPath('/workspace/dart/aaa/lib/b.dart');
+    var cPath = convertPath('/workspace/dart/aaa/lib/c.dart');
 
     newFile('/workspace/dart/aaa/lib/a.dart', content: r'''
 class A {}
@@ -594,9 +594,9 @@
   }
 
   test_unusedFiles_mutilple() async {
-    var dPath = '/workspace/dart/aaa/lib/d.dart';
-    var ePath = '/workspace/dart/aaa/lib/e.dart';
-    var fPath = '/workspace/dart/aaa/lib/f.dart';
+    var dPath = convertPath('/workspace/dart/aaa/lib/d.dart');
+    var ePath = convertPath('/workspace/dart/aaa/lib/e.dart');
+    var fPath = convertPath('/workspace/dart/aaa/lib/f.dart');
 
     newFile('/workspace/dart/aaa/lib/a.dart', content: r'''
 class A {}
diff --git a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
index 2e1cf37..62d5564 100644
--- a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
@@ -91,8 +91,12 @@
       }
       FreshTypeParameters freshTypeParameters =
           getFreshTypeParameters(typeParameters);
-      typedef.typeParametersOfFunctionType
-          .addAll(freshTypeParameters.freshTypeParameters);
+      for (int i = 0; i < freshTypeParameters.freshTypeParameters.length; i++) {
+        TypeParameter typeParameter =
+            freshTypeParameters.freshTypeParameters[i];
+        typedef.typeParametersOfFunctionType
+            .add(typeParameter..parent = typedef);
+      }
 
       if (type.formals != null) {
         for (FormalParameterBuilder formal in type.formals) {
@@ -103,6 +107,7 @@
           } else {
             typedef.positionalParameters.add(parameter);
           }
+          parameter.parent = typedef;
         }
       }
     } else if (type is NamedTypeBuilder || type is FixedTypeBuilder) {
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index ced3c9e..22f1718 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -1115,8 +1115,10 @@
     readAndPushTypeParameterList(node.typeParametersOfFunctionType, node);
     node.positionalParameters.clear();
     node.positionalParameters.addAll(readAndPushVariableDeclarationList());
+    setParents(node.positionalParameters, node);
     node.namedParameters.clear();
     node.namedParameters.addAll(readAndPushVariableDeclarationList());
+    setParents(node.namedParameters, node);
     typeParameterStack.length = 0;
     variableStack.length = 0;
     node.fileOffset = fileOffset;
diff --git a/pkg/nnbd_migration/TRIAGE.md b/pkg/nnbd_migration/TRIAGE.md
new file mode 100644
index 0000000..1abd578
--- /dev/null
+++ b/pkg/nnbd_migration/TRIAGE.md
@@ -0,0 +1,72 @@
+# Triage Priorities for Dart Migration tool
+
+This document describes the relative priorities for bugs filed under the
+`area-migration` tag in GitHub as in
+[this search](https://github.com/dart-lang/sdk/issues?q=is%3Aopen+is%3Aissue+label%3Aarea-migration).
+While there are always exceptions to any rule, in general try to align our
+priorities with these definitions.
+
+To triage bugs, search for `area-migration`
+[bugs that are not currently triaged](https://github.com/dart-lang/sdk/issues?q=is%3Aopen+is%3Aissue+label%3Aarea-migration+-label%3AP0+-label%3AP1+-label%3AP2+-label%3AP3+-label%3AP4)
+and for each bug, mark priority based on how closely it matches with the below
+constraints.
+
+## Migration tool triage priorities
+
+Descriptions here use [terms and definitions](#terms-and-definitions) from the
+end of this document.  If your bug doesn't precisely match one of these,
+consider how impactful it is compared to examples given here and pick a priority
+reflecting that.
+
+### P0
+
+* Crashes that can't be worked around by `--ignore-exceptions`, typical impact or widespread.
+* Crashes that can be worked around by `--ignore-exceptions`, widespread.
+
+### P1
+
+* Crashes that can be worked around by `--ignore-exceptions`, typical impact.
+* An enhancement required for critical milestones for key users, or that has
+  significant evidence gathered indicating a positive impact if implemented.
+* A problem that is significantly impairing a key user's ability to migrate
+  their code.
+
+### P2
+
+* Crashes, edge case.
+* An enhancement with typical impact that doesn't fit the criteria above but
+  would still be significantly beneficial to users (i.e. more than just a "would
+  be nice" feature).
+* A problem with typical impact that doesn't fit the criteria above, but impairs
+  users' ability to migrate their code.
+
+### P3
+
+* Crashes, theoretical.
+* An enhancement that doesn't fit the criteria above.
+* A problem that doesn't fit the criteria above, but impairs users' ability to
+  migrate their code.
+
+## Terms and definitions
+
+### Terms describing impact
+
+* "widespread" - Impact endemic throughout the ecosystem, or at least far
+  enough that this is impacting multiple key users.
+* "typical impact" - Known to impact a key user, or likely to impact a
+  significant percentage of all users.  Issues are assumed to have typical
+  impact unless we have evidence otherwise.
+* "edge cases" - Impacting only small parts of the ecosystem.  For example, one
+  package, or one key user with a workaround.  Note this is an edge case from
+  the perspective of the ecosystem vs. language definition.  Note that since the
+  migration tool is still in an early adoption phase, if a bug has only been
+  reported by one user, that's not sufficient evidence that it's an edge case.
+  To be considered an edge case, we need to have a concrete reason to suspect
+  that the bug is caused by an unusual pattern in the user's source code, or
+  unusual user behavior.
+* "theoretical" - Something that we think is unlikely to happen in the wild
+  and there's no evidence for it happening in the wild.
+
+### Other terms
+
+* "key users" - Flutter, Pub, Fuchsia, Dart, Google3, 1P
diff --git a/pkg/vm/lib/transformations/type_flow/analysis.dart b/pkg/vm/lib/transformations/type_flow/analysis.dart
index 36da3b6..06490ea 100644
--- a/pkg/vm/lib/transformations/type_flow/analysis.dart
+++ b/pkg/vm/lib/transformations/type_flow/analysis.dart
@@ -828,6 +828,10 @@
   }
 
   bool _isDefaultValueOfFieldObservable() {
+    if (field.isLate) {
+      return false;
+    }
+
     if (field.isStatic) {
       return true;
     }
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/write_only_field3_nnbd.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/write_only_field3_nnbd.dart.expect
index b363f58..d43e95d 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/write_only_field3_nnbd.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/write_only_field3_nnbd.dart.expect
@@ -12,7 +12,7 @@
 [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasNonThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:3]  set /*isNullableByDefault*/ x(core::int value) → void;
 }
 class B extends core::Object {
-[@vm.inferred-type.metadata=dart.core::_Smi?] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasNonThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:4,getterSelectorId:5]  late final [setter] field core::int x;
+[@vm.inferred-type.metadata=dart.core::_Smi (value: 3)] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasNonThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:4,getterSelectorId:5] [@vm.unboxing-info.metadata=(i)->i]  late final [setter] field core::int x;
   synthetic constructor •() → self::B
     : super core::Object::•()
     ;
@@ -20,7 +20,7 @@
     [@vm.direct-call.metadata=#lib::B.x] [@vm.inferred-type.metadata=!? (skip check)] this.{self::B::x} = 3;
   }
 }
-[@vm.inferred-type.metadata=dart.core::_Smi?]late static final field core::int staticLateB;
+[@vm.inferred-type.metadata=dart.core::_Smi (value: 4)] [@vm.unboxing-info.metadata=(i)->i]late static final field core::int staticLateB;
 static method main() → void {
   [@vm.direct-call.metadata=#lib::A.use] [@vm.inferred-type.metadata=!? (skip check)] new self::A::•().{self::A::use}();
   [@vm.direct-call.metadata=#lib::B.use] [@vm.inferred-type.metadata=!? (skip check)] new self::B::•().{self::B::use}();
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index bfce47e..db22d30 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -11740,18 +11740,6 @@
   return Field::null();
 }
 
-void Library::CloneMetadataFrom(const Library& from_library,
-                                const Function& from_fun,
-                                const Function& to_fun) const {
-  const String& metaname = String::Handle(MakeMetadataName(from_fun));
-  const Field& from_field =
-      Field::Handle(from_library.GetMetadataField(metaname));
-  if (!from_field.IsNull()) {
-    AddFunctionMetadata(to_fun, from_field.token_pos(),
-                        from_field.kernel_offset());
-  }
-}
-
 ObjectPtr Library::GetMetadata(const Object& obj) const {
 #if defined(DART_PRECOMPILED_RUNTIME)
   return Object::empty_array().raw();
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 21476d9..46354d0 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -4709,9 +4709,6 @@
                           intptr_t kernel_offset) const;
   void AddTypeParameterMetadata(const TypeParameter& param,
                                 TokenPosition token_pos) const;
-  void CloneMetadataFrom(const Library& from_library,
-                         const Function& from_fun,
-                         const Function& to_fun) const;
   ObjectPtr GetMetadata(const Object& obj) const;
 
   // Tries to finds a @pragma annotation on [object].
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index 802d7a4..08bfa23 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -1453,6 +1453,7 @@
   const StackTrace& allocation_location_ =
       StackTrace::Handle(allocation_location());
   const String& debug_name_ = String::Handle(debug_name());
+  obj.AddServiceId(*this);
   obj.AddProperty("kind", "ReceivePort");
   obj.AddProperty64("portId", Id());
   obj.AddProperty("debugName", debug_name_.ToCString());
diff --git a/runtime/vm/virtual_memory_posix.cc b/runtime/vm/virtual_memory_posix.cc
index 7010b26..350c241 100644
--- a/runtime/vm/virtual_memory_posix.cc
+++ b/runtime/vm/virtual_memory_posix.cc
@@ -16,6 +16,7 @@
 
 #include "platform/assert.h"
 #include "platform/utils.h"
+#include "vm/heap/pages.h"
 #include "vm/isolate.h"
 
 // #define VIRTUAL_MEMORY_LOGGING 1
@@ -75,7 +76,7 @@
   // Also detect for missing support of memfd_create syscall.
   if (FLAG_dual_map_code) {
     intptr_t size = PageSize();
-    intptr_t alignment = 256 * 1024;  // e.g. heap page size.
+    intptr_t alignment = kOldPageSize;
     VirtualMemory* vm = AllocateAligned(size, alignment, true, "memfd-test");
     if (vm == NULL) {
       LOG_INFO("memfd_create not supported; disabling dual mapping of code.\n");
@@ -93,6 +94,25 @@
     delete vm;
   }
 #endif  // defined(DUAL_MAPPING_SUPPORTED)
+
+#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
+  FILE* fp = fopen("/proc/sys/vm/max_map_count", "r");
+  if (fp != nullptr) {
+    size_t max_map_count = 0;
+    int count = fscanf(fp, "%zu", &max_map_count);
+    fclose(fp);
+    if (count == 1) {
+      size_t max_heap_pages = FLAG_old_gen_heap_size * MB / kOldPageSize;
+      if (max_map_count < max_heap_pages) {
+        OS::PrintErr(
+            "warning: vm.max_map_count (%zu) is not large enough to support "
+            "--old_gen_heap_size=%d. Consider increasing it with `sysctl -w "
+            "vm.max_map_count=%zu`\n",
+            max_map_count, FLAG_old_gen_heap_size, max_heap_pages);
+      }
+    }
+  }
+#endif
 }
 
 bool VirtualMemory::DualMappingEnabled() {
diff --git a/sdk/lib/_internal/vm/lib/array.dart b/sdk/lib/_internal/vm/lib/array.dart
index 1e2f9c0..643faf4 100644
--- a/sdk/lib/_internal/vm/lib/array.dart
+++ b/sdk/lib/_internal/vm/lib/array.dart
@@ -280,10 +280,7 @@
     assert(array is _List<E> || array is _ImmutableList<E>);
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 
   @pragma("vm:prefer-inline")
   bool moveNext() {
diff --git a/sdk/lib/_internal/vm/lib/collection_patch.dart b/sdk/lib/_internal/vm/lib/collection_patch.dart
index 1307fb7..a1acbcb 100644
--- a/sdk/lib/_internal/vm/lib/collection_patch.dart
+++ b/sdk/lib/_internal/vm/lib/collection_patch.dart
@@ -845,10 +845,7 @@
     return false;
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 }
 
 /**
diff --git a/sdk/lib/_internal/vm/lib/compact_hash.dart b/sdk/lib/_internal/vm/lib/compact_hash.dart
index db903e4..4574455 100644
--- a/sdk/lib/_internal/vm/lib/compact_hash.dart
+++ b/sdk/lib/_internal/vm/lib/compact_hash.dart
@@ -474,10 +474,7 @@
     }
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 }
 
 // Set implementation, analogous to _CompactLinkedHashMap.
diff --git a/sdk/lib/_internal/vm/lib/core_patch.dart b/sdk/lib/_internal/vm/lib/core_patch.dart
index d138549..34b26f3 100644
--- a/sdk/lib/_internal/vm/lib/core_patch.dart
+++ b/sdk/lib/_internal/vm/lib/core_patch.dart
@@ -133,10 +133,7 @@
   Iterable<T>? _yieldEachIterable;
 
   @override
-  T get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as T;
-  }
+  T get current => _current as T;
 
   _SyncIterator(this._moveNextFn);
 
diff --git a/sdk/lib/_internal/vm/lib/immutable_map.dart b/sdk/lib/_internal/vm/lib/immutable_map.dart
index 7be9890..2f653f5 100644
--- a/sdk/lib/_internal/vm/lib/immutable_map.dart
+++ b/sdk/lib/_internal/vm/lib/immutable_map.dart
@@ -173,10 +173,7 @@
     return false;
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 }
 
 class _ImmutableMapValueIterator<E> implements Iterator<E> {
@@ -197,10 +194,7 @@
     return false;
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 }
 
 class _ImmutableMapEntryIterator<K, V> implements Iterator<MapEntry<K, V>> {
@@ -222,8 +216,5 @@
     return false;
   }
 
-  MapEntry<K, V> get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as MapEntry<K, V>;
-  }
+  MapEntry<K, V> get current => _current as MapEntry<K, V>;
 }
diff --git a/sdk/lib/_internal/vm/lib/string_patch.dart b/sdk/lib/_internal/vm/lib/string_patch.dart
index 18c1b56..a8b949a 100644
--- a/sdk/lib/_internal/vm/lib/string_patch.dart
+++ b/sdk/lib/_internal/vm/lib/string_patch.dart
@@ -1424,8 +1424,5 @@
     return true;
   }
 
-  Match get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as Match;
-  }
+  Match get current => _current as Match;
 }
diff --git a/sdk/lib/_internal/vm/lib/typed_data_patch.dart b/sdk/lib/_internal/vm/lib/typed_data_patch.dart
index 8139cb5..d608ab6 100644
--- a/sdk/lib/_internal/vm/lib/typed_data_patch.dart
+++ b/sdk/lib/_internal/vm/lib/typed_data_patch.dart
@@ -4016,10 +4016,7 @@
     return false;
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 }
 
 abstract class _TypedListView extends _TypedListBase implements TypedData {
diff --git a/sdk/lib/collection/linked_list.dart b/sdk/lib/collection/linked_list.dart
index 843eedd..71e0226 100644
--- a/sdk/lib/collection/linked_list.dart
+++ b/sdk/lib/collection/linked_list.dart
@@ -181,10 +181,7 @@
         _next = list._first,
         _visitedFirst = false;
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 
   bool moveNext() {
     if (_modificationCount != _list._modificationCount) {
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index 85a3155..90ecb6a 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -258,10 +258,7 @@
     return false;
   }
 
-  V get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as V;
-  }
+  V get current => _current as V;
 }
 
 /// Mixin that overrides mutating map operations with implementations that
diff --git a/sdk/lib/collection/queue.dart b/sdk/lib/collection/queue.dart
index 26abbfe..c238840 100644
--- a/sdk/lib/collection/queue.dart
+++ b/sdk/lib/collection/queue.dart
@@ -518,10 +518,7 @@
     return true;
   }
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 }
 
 /// List based [Queue].
@@ -901,10 +898,7 @@
         _modificationCount = queue._modificationCount,
         _position = queue._head;
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 
   bool moveNext() {
     _queue._checkModification(_modificationCount);
diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
index 2817132..55134af 100644
--- a/sdk/lib/internal/iterable.dart
+++ b/sdk/lib/internal/iterable.dart
@@ -325,10 +325,7 @@
         _length = iterable.length,
         _index = 0;
 
-  E get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as E;
-  }
+  E get current => _current as E;
 
   @pragma("vm:prefer-inline")
   bool moveNext() {
@@ -396,10 +393,7 @@
     return false;
   }
 
-  T get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as T;
-  }
+  T get current => _current as T;
 }
 
 /**
@@ -471,10 +465,7 @@
 
   ExpandIterator(this._iterator, this._f);
 
-  T get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as T;
-  }
+  T get current => _current as T;
 
   bool moveNext() {
     if (_currentExpansion == null) return false;
diff --git a/sdk/lib/internal/linked_list.dart b/sdk/lib/internal/linked_list.dart
index b5e5275..ddb0331 100644
--- a/sdk/lib/internal/linked_list.dart
+++ b/sdk/lib/internal/linked_list.dart
@@ -99,10 +99,7 @@
   /// The current element of the iterator.
   T? _current;
 
-  T get current {
-    final cur = _current;
-    return (cur != null) ? cur : cur as T;
-  }
+  T get current => _current as T;
 
   /// The list the iterator iterates over.
   ///
diff --git a/tools/VERSION b/tools/VERSION
index 8870174..9c520c2 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 12
 PATCH 0
-PRERELEASE 54
+PRERELEASE 55
 PRERELEASE_PATCH 0
\ No newline at end of file