Index: pkg/analyzer/test/generated/non_error_resolver_test.dart |
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart |
index 8392f69dc190c39864802fbe43ac34c0a1a28cdb..25e7f50fc3615a4ad020d997827e724d897721b8 100644 |
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart |
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart |
@@ -2184,6 +2184,42 @@ class B extends A implements Function { |
verify([source]); |
} |
+ test_genericTypeAlias_castsAndTypeChecks_hasTypeParameters() async { |
+ Source source = addSource(''' |
+typedef Foo<S> = S Function<T>(T x); |
+ |
+main(Object p) { |
+ (p as Foo)<int>(3); |
+ if (p is Foo) { |
+ p<int>(3); |
+ } |
+ (p as Foo<String>)<int>(3); |
+ if (p is Foo<String>) { |
+ p<int>(3); |
+ } |
+} |
+'''); |
+ await computeAnalysisResult(source); |
+ assertNoErrors(source); |
+ verify([source]); |
+ } |
+ |
+ test_genericTypeAlias_castsAndTypeChecks_noTypeParameters() async { |
+ Source source = addSource(''' |
+typedef Foo = T Function<T>(T x); |
+ |
+main(Object p) { |
+ (p as Foo)<int>(3); |
+ if (p is Foo) { |
+ p<int>(3); |
+ } |
+} |
+'''); |
+ await computeAnalysisResult(source); |
+ assertNoErrors(source); |
+ verify([source]); |
+ } |
+ |
test_genericTypeAlias_fieldAndReturnType_noTypeParameters() async { |
Source source = addSource(r''' |
typedef Foo = int Function<T>(T x); |
@@ -2247,6 +2283,19 @@ class A { |
verify([source]); |
} |
+ test_genericTypeAlias_invalidGenericFunctionType() async { |
+ Source source = addSource(''' |
+typedef F = int; |
+main(p) { |
+ p is F; |
+} |
+'''); |
+ await computeAnalysisResult(source); |
+ // There is a parse error, but no crashes. |
+ assertErrors(source, [ParserErrorCode.INVALID_GENERIC_FUNCTION_TYPE]); |
+ verify([source]); |
+ } |
+ |
test_genericTypeAlias_noTypeParameters() async { |
Source source = addSource(r''' |
typedef Foo = int Function<T>(T x); |