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

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

Issue 1993333003: Fix for resynthesizing default values referencing type parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 7ba9dc39366f9f76a02fb530d11da43fefe762c3..ca5bf7976fb60af5237a74bb800cece7e67aa9d7 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -515,8 +515,13 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
expect(rType, isNotNull, reason: desc);
compareConstAsts(rType.name, oType.name, desc);
compareConstAsts(rConstructor.name, oConstructor.name, desc);
- compareConstAstLists(rType.typeArguments?.arguments,
- oType.typeArguments?.arguments, desc);
+ // In strong mode type inference is performed, so that
+ // `C<int> v = new C();` is serialized as `C<int> v = new C<int>();`.
+ // So, if there are not type arguments originally, not need to check.
+ if (oType.typeArguments?.arguments?.isNotEmpty ?? false) {
+ compareConstAstLists(rType.typeArguments?.arguments,
+ oType.typeArguments?.arguments, desc);
+ }
compareConstAstLists(
r.argumentList.arguments, o.argumentList.arguments, desc);
} else if (o is AnnotationImpl && r is AnnotationImpl) {
@@ -2527,6 +2532,29 @@ class C {
''');
}
+ test_constructor_default_refers_to_generic_class() {
+ checkLibrary('''
+class B<T> {
+ const B();
+}
+class C<T> {
+ const C([B<T> b = const B()]);
+}
+''');
+ }
+
+ test_constructor_default_refers_to_generic_class2() {
+ checkLibrary('''
+abstract class A<T> {}
+class B<T> implements A<T> {
+ const B();
+}
+class C<T> implements A<Iterable<T>> {
+ const C([A<T> a = const B()]);
+}
+''');
+ }
+
test_constructor_documented() {
checkLibrary('''
class C {
« 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