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

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

Issue 1956473004: Fix ast-based serialization of out-of-scope type parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove temporary debugging code. 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/test/src/summary/linker_test.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/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 3151089bb1bdd15478ca79f9c309efea3fd39ec2..802d838f316090e5ff4299854dc46efed117f735 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -7549,6 +7549,35 @@ class D extends p.C {} // Prevent "unused import" warning
expect(unlinkedUnits[0].imports[0].uri, 'dart:async');
}
+ test_inferred_function_type_parameter_type_with_unrelated_type_param() {
+ if (!strongMode || skipFullyLinkedData) {
+ return;
+ }
+ // The type that is inferred for C.f's parameter g is "() -> void".
+ // Since the associated element for that function type is B.f's parameter g,
+ // and B has a type parameter, the inferred type will record a type
+ // parameter. However, since that type parameter is irrelevant, the summary
+ // should encode it as `dynamic`.
+ UnlinkedClass c = serializeClassText('''
+abstract class B<T> {
+ void f(void g());
+}
+class C<T> extends B<T> {
+ void f(g) {}
+}
+''');
+ expect(c.executables, hasLength(1));
+ UnlinkedExecutable f = c.executables[0];
+ expect(f.parameters, hasLength(1));
+ UnlinkedParam g = f.parameters[0];
+ expect(g.name, 'g');
+ EntityRef typeRef = getTypeRefForSlot(g.inferredTypeSlot);
+ checkLinkedTypeRef(typeRef, null, null, 'f',
+ expectedKind: ReferenceKind.method, allowTypeArguments: true);
+ expect(typeRef.typeArguments, hasLength(1));
+ checkLinkedTypeRef(typeRef.typeArguments[0], null, null, 'dynamic');
+ }
+
test_inferred_type_keeps_leading_dynamic() {
if (!strongMode || skipFullyLinkedData) {
return;
« no previous file with comments | « pkg/analyzer/test/src/summary/linker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698