Fix NPE when accessing superclass

Change-Id: I64da591bfa33a5202b7bd15de451be84330cc8bb
Reviewed-on: https://dart-review.googlesource.com/75403
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index a076197..b1303b0 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -1389,6 +1389,9 @@
         _typeArguments = _typeArgumentsComputer();
       } on RecursiveInstantiateToBounds {
         _hasTypeParameterReferenceInBound = true;
+        _typeArguments = new List<DartType>.filled(
+            element.typeParameters.length,
+            element.context.typeProvider.dynamicType);
       }
       _typeArgumentsComputer = null;
     }
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index ca03d8e..1fd77a5 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -2311,6 +2311,17 @@
     expect(_getTopLevelVarType(result.unit, 'b'), 'B');
   }
 
+  test_instantiateToBounds_invalid() async {
+    var a = _p('/test/lib/a.dart');
+    provider.newFile(a, r'''
+class A<T extends B> {}
+class B<T extends A<B>> {}
+''');
+
+    driver.addFile(a);
+    await waitForIdleWithoutExceptions();
+  }
+
   test_knownFiles() async {
     var a = _p('/test/lib/a.dart');
     var b = _p('/test/lib/b.dart');
diff --git a/tests/co19_2/co19_2-analyzer.status b/tests/co19_2/co19_2-analyzer.status
index 8eaefac..054926b 100644
--- a/tests/co19_2/co19_2-analyzer.status
+++ b/tests/co19_2/co19_2-analyzer.status
@@ -170,15 +170,14 @@
 LanguageFeatures/Instantiate-to-bound/Callable/Callable_ret_extends_neg_assign_l1_t19: MissingCompileTimeError # Issue 34087
 LanguageFeatures/Instantiate-to-bound/Callable/Callable_ret_extends_neg_assign_l1_t20: MissingCompileTimeError # Issue 34087
 LanguageFeatures/Instantiate-to-bound/Callable/Callable_ret_extends_neg_assign_l1_t21: MissingCompileTimeError # Issue 34087
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l3_t01: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l3_t02: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t01: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t02: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t03: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t04: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t05: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t06: Crash # Issue 33152, 33477
-LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t07: Crash # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l3_t01: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l3_t02: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t01: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t02: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t03: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t05: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t06: MissingCompileTimeError # Issue 33152, 33477
+LanguageFeatures/Instantiate-to-bound/class/custom_extends_neg_assign_l4_t07: MissingCompileTimeError # Issue 33152, 33477
 LanguageFeatures/Instantiate-to-bound/function/function_named_extends_neg_assign_l1_t10: CompileTimeError # Issue 33995
 LanguageFeatures/Instantiate-to-bound/function/function_named_extends_pos_l1_t04: CompileTimeError # Issue 33995
 LanguageFeatures/Instantiate-to-bound/function/function_named_extends_pos_l1_t05: CompileTimeError # Issue 33995