Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1901)

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1569923002: Fix some corner cases of resynthesizing generic function types. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 4738af2aad49ae8156c90373025ba2473475be73..3fc75b7d7f1766ed873e179971320dcd11089002 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -5,6 +5,7 @@
library test.src.serialization.elements_test;
import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/summary/base.dart';
import 'package:analyzer/src/summary/format.dart';
@@ -397,6 +398,8 @@ class ResynthTest extends ResolverTestCase {
} else if (resynthesized is FunctionTypeImpl &&
original is FunctionTypeImpl) {
compareTypeImpls(resynthesized, original, desc);
+ expect(resynthesized.isInstantiated, original.isInstantiated,
+ reason: desc);
if (original.element.isSynthetic &&
original.element is FunctionTypeAliasElementImpl &&
resynthesized.element is FunctionTypeAliasElementImpl) {
@@ -806,6 +809,16 @@ class E {
checkLibrary('void f() {}');
}
+ test_function_type_parameter() {
+ resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ checkLibrary('T f<T, U>(U u) => null;');
+ }
+
+ test_function_type_parameter_with_function_typed_parameter() {
+ resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ checkLibrary('void f<T, U>(T x(U u)) {}');
+ }
+
test_functions() {
checkLibrary('f() {} g() {}');
}
@@ -868,6 +881,21 @@ class E {
checkLibrary('class C { f(void g()) {} }');
}
+ test_method_type_parameter() {
+ resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ checkLibrary('class C { T f<T, U>(U u) => null; }');
+ }
+
+ test_method_type_parameter_in_generic_class() {
+ resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ checkLibrary('class C<T, U> { V f<V, W>(T t, U u, W w) => null; }');
+ }
+
+ test_method_type_parameter_with_function_typed_parameter() {
+ resetWithOptions(new AnalysisOptionsImpl()..enableGenericMethods = true);
+ checkLibrary('class C { void f<T, U>(T x(U u)) {} }');
+ }
+
test_operator() {
checkLibrary('class C { C operator+(C other) => null; }');
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698