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

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

Issue 1694763003: Test and fix resynthesis of nested generic functions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove workarounds now that #25769 is fixed Created 4 years, 10 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/resynthesize_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 f72111488262a9da52cdca6cd22f9d323d6c0df7..267683bbd367f7cd71b38a1c192a7c525a821488 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -5737,6 +5737,63 @@ class C {
expect(f.inferredReturnTypeSlot, 0);
}
+ test_nested_generic_functions() {
+ UnlinkedExecutable executable = serializeExecutableText('''
+void f<T, U>() {
+ void g<V, W>() {
+ void h<X, Y>() {
+ T t;
+ U u;
+ V v;
+ W w;
+ X x;
+ Y y;
+ }
+ }
+}
+''');
+ expect(executable.typeParameters, hasLength(2));
+ expect(executable.localFunctions[0].typeParameters, hasLength(2));
+ expect(executable.localFunctions[0].localFunctions[0].typeParameters,
+ hasLength(2));
+ List<UnlinkedVariable> localVariables =
+ executable.localFunctions[0].localFunctions[0].localVariables;
+ checkParamTypeRef(findVariable('t', variables: localVariables).type, 6);
+ checkParamTypeRef(findVariable('u', variables: localVariables).type, 5);
+ checkParamTypeRef(findVariable('v', variables: localVariables).type, 4);
+ checkParamTypeRef(findVariable('w', variables: localVariables).type, 3);
+ checkParamTypeRef(findVariable('x', variables: localVariables).type, 2);
+ checkParamTypeRef(findVariable('y', variables: localVariables).type, 1);
+ }
+
+ test_nested_generic_functions_in_generic_class() {
+ UnlinkedClass cls = serializeClassText('''
+class C<T, U> {
+ void g<V, W>() {
+ void h<X, Y>() {
+ T t;
+ U u;
+ V v;
+ W w;
+ X x;
+ Y y;
+ }
+ }
+}
+''');
+ expect(cls.typeParameters, hasLength(2));
+ expect(cls.executables[0].typeParameters, hasLength(2));
+ expect(cls.executables[0].localFunctions[0].typeParameters, hasLength(2));
+ List<UnlinkedVariable> localVariables =
+ cls.executables[0].localFunctions[0].localVariables;
+ checkParamTypeRef(findVariable('t', variables: localVariables).type, 6);
+ checkParamTypeRef(findVariable('u', variables: localVariables).type, 5);
+ checkParamTypeRef(findVariable('v', variables: localVariables).type, 4);
+ checkParamTypeRef(findVariable('w', variables: localVariables).type, 3);
+ checkParamTypeRef(findVariable('x', variables: localVariables).type, 2);
+ checkParamTypeRef(findVariable('y', variables: localVariables).type, 1);
+ }
+
test_parameter_visibleRange_abstractMethod() {
UnlinkedExecutable m = findExecutable('m',
executables:
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698