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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1712583004: Test and fix resynthesis of generic closures. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Reference bug from TODO comments. 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 2911 matching lines...) Expand 10 before | Expand all | Expand 10 after
2922 // `() => int`, with 2 (unused) type parameters from the enclosing class. 2922 // `() => int`, with 2 (unused) type parameters from the enclosing class.
2923 checkLibrary(''' 2923 checkLibrary('''
2924 class C<U, V> { 2924 class C<U, V> {
2925 void set x(value) { 2925 void set x(value) {
2926 print(() => () => 0); 2926 print(() => () => 0);
2927 } 2927 }
2928 } 2928 }
2929 '''); 2929 ''');
2930 } 2930 }
2931 2931
2932 test_inferred_function_type_in_generic_closure() {
2933 if (!options.strongMode) {
2934 // The test below uses generic comment syntax because proper generic
2935 // method syntax doesn't support generic closures. So it can only run in
2936 // strong mode.
2937 // TODO(paulberry): once proper generic method syntax supports generic
2938 // closures, rewrite the test below without using generic comment syntax,
2939 // and remove this hack. See dartbug.com/25819
2940 return;
2941 }
2942 // In the code below, `<U, V>() => () => 0` has an inferred return type of
2943 // `() => int`, with 3 (unused) type parameters.
2944 checkLibrary('''
2945 f<T>() {
2946 print(/*<U, V>*/() => () => 0);
2947 }
2948 ''');
2949 }
2950
2951 test_inferred_generic_function_type_in_generic_closure() {
2952 if (!options.strongMode) {
2953 // The test below uses generic comment syntax because proper generic
2954 // method syntax doesn't support generic closures. So it can only run in
2955 // strong mode.
2956 // TODO(paulberry): once proper generic method syntax supports generic
2957 // closures, rewrite the test below without using generic comment syntax,
2958 // and remove this hack. See dartbug.com/25819
2959 return;
2960 }
2961 // In the code below, `<U, V>() => <W, X, Y, Z>() => 0` has an inferred
2962 // return type of `() => int`, with 7 (unused) type parameters.
2963 checkLibrary('''
2964 f<T>() {
2965 print(/*<U, V>*/() => /*<W, X, Y, Z>*/() => 0);
2966 }
2967 ''');
2968 }
2969
2932 test_inferred_type_is_typedef() { 2970 test_inferred_type_is_typedef() {
2933 checkLibrary('typedef int F(String s);' 2971 checkLibrary('typedef int F(String s);'
2934 ' class C extends D { var v; }' 2972 ' class C extends D { var v; }'
2935 ' abstract class D { F get v; }'); 2973 ' abstract class D { F get v; }');
2936 } 2974 }
2937 2975
2938 test_inferred_type_refers_to_bound_type_param() { 2976 test_inferred_type_refers_to_bound_type_param() {
2939 checkLibrary('class C<T> extends D<int, T> { var v; }' 2977 checkLibrary('class C<T> extends D<int, T> { var v; }'
2940 ' abstract class D<U, V> { Map<V, U> get v; }'); 2978 ' abstract class D<U, V> { Map<V, U> get v; }');
2941 } 2979 }
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
3913 fail('Unexpectedly tried to get unlinked summary for $uri'); 3951 fail('Unexpectedly tried to get unlinked summary for $uri');
3914 } 3952 }
3915 return serializedUnit; 3953 return serializedUnit;
3916 } 3954 }
3917 3955
3918 @override 3956 @override
3919 bool hasLibrarySummary(String uri) { 3957 bool hasLibrarySummary(String uri) {
3920 return true; 3958 return true;
3921 } 3959 }
3922 } 3960 }
OLDNEW
« 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