Fix incorrect handling of non-generic typedefs.

Currently a typedef is represented by two elements: an "outer" element
that points to the typedef and has type GenericTypeAliasElementImpl,
and an "inner" element that points to the RHS of the typedef and has
type GenericFunctionTypeElementImpl.  GenericTypeAliasElementImpl.type
is never used and handles generic parameters incorrectly;
GenericFunctionTypeElementImpl.type should always be used instead.

I plan to clean all this up as part of #33641, but this CL is
sufficient to get tests passing.

Change-Id: Ib2d9af9294f4f9d94bfbbeff9aaae711f8cdad1d
Reviewed-on: https://dart-review.googlesource.com/62540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index ae458d7..50fa260 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -5661,7 +5661,7 @@
     if (argumentTypes.length != typeParameters.length) {
       throw new ArgumentError('Wrong number of type arguments supplied');
     }
-    if (typeParameters.isEmpty) return type;
+    if (typeParameters.isEmpty) return function.type;
     return typeAfterSubstitution(argumentTypes);
   }
 
diff --git a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
index 2981fd6..8f9548d 100644
--- a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
@@ -447,13 +447,6 @@
 
   @override
   @failingTest
-  test_inferClosureType_parameters() {
-    // See dartbug.com/33641
-    return super.test_inferClosureType_parameters();
-  }
-
-  @override
-  @failingTest
   test_notInstantiatedBound_class_error_recursion_typedef() {
     // Expected 2 errors of type
     // StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0; 1 errors of
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index b23f4b7..359b16c 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -147,20 +147,6 @@
   test_const_constructor_inferred_args() =>
       super.test_const_constructor_inferred_args();
 
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_const_reference_type_functionType() {
-    return super.test_const_reference_type_functionType();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_const_topLevel_typedList_typedefArgument() {
-    return super.test_const_topLevel_typedList_typedefArgument();
-  }
-
   @failingTest
   @FastaProblem('https://github.com/dart-lang/sdk/issues/30258')
   test_constructor_redirected_factory_named_generic() async {
@@ -197,13 +183,6 @@
     await super.test_constructor_redirected_factory_unnamed_prefixed_generic();
   }
 
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_executable_parameter_type_typedef() {
-    return super.test_executable_parameter_type_typedef();
-  }
-
   @failingTest
   @notForDart2
   test_export_configurations_useFirst() async {
@@ -274,27 +253,6 @@
 
   @override
   @failingTest
-  @potentialAnalyzerProblem
-  test_infer_generic_typedef_simple() {
-    return super.test_infer_generic_typedef_simple();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_inferred_type_is_typedef() {
-    return super.test_inferred_type_is_typedef();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_inferred_type_refers_to_function_typed_param_of_typedef() {
-    return super.test_inferred_type_refers_to_function_typed_param_of_typedef();
-  }
-
-  @override
-  @failingTest
   test_invalid_annotation_prefixed_constructor() {
     return super.test_invalid_annotation_prefixed_constructor();
   }
@@ -403,104 +361,6 @@
     await super.test_type_inference_based_on_loadLibrary();
   }
 
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_lib_to_lib() {
-    return super.test_type_reference_lib_to_lib();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_lib_to_part() {
-    return super.test_type_reference_lib_to_part();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_part_to_lib() {
-    return super.test_type_reference_part_to_lib();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_part_to_other_part() {
-    return super.test_type_reference_part_to_other_part();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_part_to_part() {
-    return super.test_type_reference_part_to_part();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import() {
-    return super.test_type_reference_to_import();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_export() {
-    return super.test_type_reference_to_import_export();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_export_export() {
-    return super.test_type_reference_to_import_export_export();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_export_export_in_subdirs() {
-    return super.test_type_reference_to_import_export_export_in_subdirs();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_export_in_subdirs() {
-    return super.test_type_reference_to_import_export_in_subdirs();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_part() {
-    return super.test_type_reference_to_import_part();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_part_in_subdir() {
-    return super.test_type_reference_to_import_part_in_subdir();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_import_relative() {
-    return super.test_type_reference_to_import_relative();
-  }
-
-  @override
-  @failingTest
-  @potentialAnalyzerProblem
-  test_type_reference_to_typedef() {
-    return super.test_type_reference_to_typedef();
-  }
-
   @failingTest
   @potentialAnalyzerProblem
   test_typedef_type_parameters_bound() async {