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

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

Issue 1647253002: Add the ability to summarize inferred types based on function-typed parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
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 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/dart/element/type.dart'; 10 import 'package:analyzer/src/dart/element/type.dart';
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 checkLibrary('typedef int F(String s);' 1494 checkLibrary('typedef int F(String s);'
1495 ' class C extends D { var v; }' 1495 ' class C extends D { var v; }'
1496 ' abstract class D { F get v; }'); 1496 ' abstract class D { F get v; }');
1497 } 1497 }
1498 1498
1499 test_inferred_type_refers_to_bound_type_param() { 1499 test_inferred_type_refers_to_bound_type_param() {
1500 checkLibrary('class C<T> extends D<int, T> { var v; }' 1500 checkLibrary('class C<T> extends D<int, T> { var v; }'
1501 ' abstract class D<U, V> { Map<V, U> get v; }'); 1501 ' abstract class D<U, V> { Map<V, U> get v; }');
1502 } 1502 }
1503 1503
1504 test_inferred_type_via_function_typed_param() { 1504 test_inferred_type_refers_to_method_function_typed_parameter_type() {
1505 if (options.strongMode) { 1505 checkLibrary('class C extends D { void f(int x, g) {} }'
1506 // TODO(paulberry): get this test to pass. 1506 ' abstract class D { void f(int x, int g(String s)); }');
1507 return; 1507 }
1508 } 1508
1509 checkLibrary('class C extends D { f(g) {} }' 1509 test_inferred_type_refers_to_setter_function_typed_parameter_type() {
1510 ' abstract class D { void f(int g(String)); }'); 1510 checkLibrary('class C extends D { void set f(g) {} }'
1511 ' abstract class D { void set f(int g(String s)); }');
1511 } 1512 }
1512 1513
1513 test_library() { 1514 test_library() {
1514 checkLibrary(''); 1515 checkLibrary('');
1515 } 1516 }
1516 1517
1517 test_library_documented() { 1518 test_library_documented() {
1518 checkLibrary(''' 1519 checkLibrary('''
1519 // Extra comment so doc comment offset != 0 1520 // Extra comment so doc comment offset != 0
1520 /** 1521 /**
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 fail('Unexpectedly tried to get unlinked summary for $uri'); 2030 fail('Unexpectedly tried to get unlinked summary for $uri');
2030 } 2031 }
2031 return serializedUnit; 2032 return serializedUnit;
2032 } 2033 }
2033 2034
2034 @override 2035 @override
2035 bool hasLibrarySummary(String uri) { 2036 bool hasLibrarySummary(String uri) {
2036 return true; 2037 return true;
2037 } 2038 }
2038 } 2039 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698