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

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

Issue 1950333003: Fix a corner case of inferred types with function-typed parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Also test resynthesis. 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
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 23571cc07865ad7a14ea4c7f3e335be1ca7a6a6b..794600cfdafbabe630b6451242b053bb2b65481a 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -7692,6 +7692,44 @@ var v = h((y) {});
checkReferenceIndex(linkedReference.containingReference, null, null, 'D');
}
+ test_inferred_type_refers_to_nested_function_typed_param_of_typedef() {
+ if (!strongMode || skipFullyLinkedData) {
+ return;
+ }
+ UnlinkedVariable v = serializeVariableText('''
+f(void g(int x, void h())) => null;
+var v = f((x, y) {});
+''');
+ expect(v.initializer.localFunctions, hasLength(1));
+ UnlinkedExecutable closure = v.initializer.localFunctions[0];
+ expect(closure.parameters, hasLength(2));
+ UnlinkedParam y = closure.parameters[1];
+ expect(y.name, 'y');
+ EntityRef typeRef = getTypeRefForSlot(y.inferredTypeSlot);
+ checkLinkedTypeRef(typeRef, null, null, 'f',
+ expectedKind: ReferenceKind.topLevelFunction);
+ expect(typeRef.implicitFunctionTypeIndices, [0, 1]);
+ }
+
+ test_inferred_type_refers_to_nested_function_typed_param_of_typedef_named() {
+ if (!strongMode || skipFullyLinkedData) {
+ return;
+ }
+ UnlinkedVariable v = serializeVariableText('''
+f({void g(int x, void h())}) => null;
+var v = f(g: (x, y) {});
+''');
+ expect(v.initializer.localFunctions, hasLength(1));
+ UnlinkedExecutable closure = v.initializer.localFunctions[0];
+ expect(closure.parameters, hasLength(2));
+ UnlinkedParam y = closure.parameters[1];
+ expect(y.name, 'y');
+ EntityRef typeRef = getTypeRefForSlot(y.inferredTypeSlot);
+ checkLinkedTypeRef(typeRef, null, null, 'f',
+ expectedKind: ReferenceKind.topLevelFunction);
+ expect(typeRef.implicitFunctionTypeIndices, [0, 1]);
+ }
+
test_inferred_type_refers_to_setter_function_typed_parameter_type() {
if (!strongMode || skipFullyLinkedData) {
return;

Powered by Google App Engine
This is Rietveld 408576698