[vm] Reify even more generics in the mirrors implementation to appease Dart 2.

Bug: https://github.com/dart-lang/sdk/issues/33091
Bug: https://github.com/dart-lang/sdk/issues/33098
Change-Id: Ibecce1274b9bda47e387d109a29a5af4d53adb7f
Reviewed-on: https://dart-review.googlesource.com/54704
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 4688f63..bbb86ea 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -658,11 +658,15 @@
   var _superinterfaces;
   List<ClassMirror> get superinterfaces {
     if (_superinterfaces == null) {
-      _superinterfaces = isOriginalDeclaration
+      var interfaceTypes = isOriginalDeclaration
           ? _nativeInterfaces(_reflectedType)
           : _nativeInterfacesInstantiated(_reflectedType);
-      _superinterfaces = new UnmodifiableListView<ClassMirror>(
-          _superinterfaces.map(reflectType));
+      var interfaceMirrors = new List<ClassMirror>();
+      for (var interfaceType in interfaceTypes) {
+        interfaceMirrors.add(reflectType(interfaceType));
+      }
+      _superinterfaces =
+          new UnmodifiableListView<ClassMirror>(interfaceMirrors);
     }
     return _superinterfaces;
   }
@@ -1311,12 +1315,14 @@
   _LocalLibraryDependencyMirror(
       this.sourceLibrary,
       this._targetMirrorOrPrefix,
-      this.combinators,
+      List<dynamic> mutableCombinators,
       prefixString,
       this.isImport,
       this.isDeferred,
       List<dynamic> unwrappedMetadata)
       : prefix = _s(prefixString),
+        combinators = new UnmodifiableListView<CombinatorMirror>(
+            mutableCombinators.cast<CombinatorMirror>()),
         metadata = new UnmodifiableListView<InstanceMirror>(
             unwrappedMetadata.map(reflect));
 
@@ -1354,7 +1360,8 @@
   final bool isShow;
 
   _LocalCombinatorMirror(identifierString, this.isShow)
-      : this.identifiers = [_s(identifierString)];
+      : this.identifiers =
+            new UnmodifiableListView<Symbol>(<Symbol>[_s(identifierString)]);
 
   bool get isHide => !isShow;
 }
diff --git a/tests/lib_2/lib_2_analyzer.status b/tests/lib_2/lib_2_analyzer.status
index 8a7efd5..346f32d 100644
--- a/tests/lib_2/lib_2_analyzer.status
+++ b/tests/lib_2/lib_2_analyzer.status
@@ -30,7 +30,6 @@
 mirrors/mirrors_nsm_mismatch_test: CompileTimeError, OK
 mirrors/mirrors_nsm_test: CompileTimeError, OK
 mirrors/mirrors_nsm_test/dart2js: CompileTimeError, OK
-mirrors/relation_subclass_test: CompileTimeError, OK
 mirrors/repeated_private_anon_mixin_app_test: CompileTimeError, OK # Intentional library name conflict.
 
 [ $compiler == dart2analyzer && !$strong ]
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index e9c9f60..bf33435 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -50,13 +50,6 @@
 
 [ $compiler == dartk && $mode == debug && $runtime == vm && $strong ]
 isolate/isolate_complex_messages_test: Crash
-mirrors/library_exports_shown_test: Crash # 31916
-mirrors/library_imports_deferred_test: Crash # 31916
-mirrors/library_imports_hidden_test: Crash # 31916
-mirrors/library_imports_metadata_test: Crash # 31916
-mirrors/library_imports_prefixed_show_hide_test: Crash # 31916
-mirrors/library_imports_prefixed_test: Crash # 31916
-mirrors/library_imports_shown_test: Crash # 31916
 mirrors/other_declarations_location_test: Crash # assertion error, TypeParameter not having position.
 
 [ $compiler == dartk && $mode == debug && $strong ]
@@ -120,7 +113,6 @@
 mirrors/generic_interface_test/none: RuntimeError
 mirrors/generic_mixin_applications_test: RuntimeError
 mirrors/generic_mixin_test: RuntimeError
-mirrors/generics_dynamic_test: RuntimeError
 mirrors/hot_get_field_test: RuntimeError
 mirrors/hot_set_field_test: RuntimeError
 mirrors/intercepted_object_test: RuntimeError # Issue 31402 (Invocation arguments)
@@ -129,15 +121,15 @@
 mirrors/invoke_private_wrong_library_test: RuntimeError
 mirrors/library_declarations_test/none: RuntimeError # Issue 31402 (Invocation arguments)
 mirrors/library_enumeration_deferred_loading_test: RuntimeError
-mirrors/library_exports_hidden_test: RuntimeError, Crash, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_exports_shown_test: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_import_deferred_loading_test: RuntimeError # Deferred loading kernel issue 28335.
-mirrors/library_imports_deferred_test: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_hidden_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_metadata_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_prefixed_show_hide_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_prefixed_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_shown_test: RuntimeError # Issue 31402 (Invocation arguments)
+mirrors/library_exports_hidden_test: RuntimeError # Issue 33098
+mirrors/library_exports_shown_test: RuntimeError # Issue 33098
+mirrors/library_import_deferred_loading_test: RuntimeError # Issue 33098
+mirrors/library_imports_deferred_test: RuntimeError # Issue 33098
+mirrors/library_imports_hidden_test: RuntimeError # Issue 33098
+mirrors/library_imports_metadata_test: RuntimeError # Issue 33098
+mirrors/library_imports_prefixed_show_hide_test: RuntimeError # Issue 33098
+mirrors/library_imports_prefixed_test: RuntimeError # Issue 33098
+mirrors/library_imports_shown_test: RuntimeError # Issue 33098
 mirrors/library_metadata_test: RuntimeError
 mirrors/load_library_test: RuntimeError
 mirrors/metadata_allowed_values_test/16: Skip # Flaky, crashes.
@@ -181,7 +173,7 @@
 mirrors/reflected_type_typevars_test: RuntimeError
 mirrors/regress_26187_test: RuntimeError
 mirrors/relation_assignable_test: RuntimeError
-mirrors/relation_subclass_test: CompileTimeError # Issue 31533
+mirrors/relation_subclass_test: RuntimeError
 mirrors/relation_subtype_test: RuntimeError
 mirrors/repeated_private_anon_mixin_app_test: RuntimeError
 mirrors/static_members_easier_test: RuntimeError # Issue 31402 (Invocation arguments)
@@ -222,10 +214,6 @@
 mirrors/constructors_test: RuntimeError
 mirrors/deferred_constraints_constants_test/default_argument2: Pass
 mirrors/fake_function_with_call_test: RuntimeError
-mirrors/generic_superclass_test/01: RuntimeError
-mirrors/generic_superclass_test/none: RuntimeError
-mirrors/hierarchy_invariants_test: RuntimeError
-mirrors/immutable_collections_test: RuntimeError
 mirrors/instance_members_easier_test: RuntimeError
 mirrors/instance_members_test: RuntimeError
 mirrors/instance_members_unimplemented_interface_test: RuntimeError
@@ -234,7 +222,6 @@
 mirrors/invoke_throws_test: RuntimeError
 mirrors/metadata_const_map_test: Crash
 mirrors/mixin_members_test: RuntimeError
-mirrors/null_test: RuntimeError
 mirrors/operator_test: RuntimeError
 mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
 mirrors/redirecting_factory_different_type_test/none: RuntimeError
@@ -315,7 +302,6 @@
 mirrors/native_class_test: CompileTimeError
 mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError
 mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
-mirrors/relation_subclass_test: CompileTimeError
 
 [ $fasta && $strong ]
 mirrors/top_level_accessors_test/01: MissingCompileTimeError
diff --git a/tests/lib_2/mirrors/relation_subclass_test.dart b/tests/lib_2/mirrors/relation_subclass_test.dart
index 704605f..7be25c2 100644
--- a/tests/lib_2/mirrors/relation_subclass_test.dart
+++ b/tests/lib_2/mirrors/relation_subclass_test.dart
@@ -66,12 +66,12 @@
   Expect.isFalse(Obj.isSubclassOf(Func));
 
   // Function typedef.
-  var NumPred = thisLibrary.declarations[#NumberPredicate];
-  var IntPred = thisLibrary.declarations[#IntegerPredicate];
-  var DubPred = thisLibrary.declarations[#DoublePredicate];
-  var NumGen = thisLibrary.declarations[#NumberGenerator];
-  var IntGen = thisLibrary.declarations[#IntegerGenerator];
-  var DubGen = thisLibrary.declarations[#DoubleGenerator];
+  dynamic NumPred = thisLibrary.declarations[#NumberPredicate];
+  dynamic IntPred = thisLibrary.declarations[#IntegerPredicate];
+  dynamic DubPred = thisLibrary.declarations[#DoublePredicate];
+  dynamic NumGen = thisLibrary.declarations[#NumberGenerator];
+  dynamic IntGen = thisLibrary.declarations[#IntegerGenerator];
+  dynamic DubGen = thisLibrary.declarations[#DoubleGenerator];
 
   isArgumentOrTypeError(e) => e is ArgumentError || e is TypeError;
   Expect.throws(() => Func.isSubclassOf(NumPred), isArgumentOrTypeError);
diff --git a/tests/lib_2/mirrors/stringify.dart b/tests/lib_2/mirrors/stringify.dart
index 32cc653..b726832 100644
--- a/tests/lib_2/mirrors/stringify.dart
+++ b/tests/lib_2/mirrors/stringify.dart
@@ -117,7 +117,7 @@
 
 stringifyDependencies(LibraryMirror l) {
   n(s) => s is Symbol ? MirrorSystem.getName(s) : s;
-  compareDep(a, b) {
+  int compareDep(a, b) {
     if (a.targetLibrary == b.targetLibrary) {
       if ((a.prefix != null) && (b.prefix != null)) {
         return n(a.prefix).compareTo(n(b.prefix));
@@ -128,8 +128,8 @@
         .compareTo(n(b.targetLibrary.simpleName));
   }
 
-  compareCom(a, b) => n(a.identifier).compareTo(n(b.identifier));
-  compareFirst(a, b) => a[0].compareTo(b[0]);
+  int compareCom(a, b) => n(a.identifier).compareTo(n(b.identifier));
+  int compareFirst(a, b) => a[0].compareTo(b[0]);
   sortBy(c, p) => new List.from(c)..sort(p);
 
   var buffer = new StringBuffer();