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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 2965423002: Stop using ExecutableElement.functions in tests. (Closed)
Patch Set: Created 3 years, 5 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/generated/resolver_test.dart ('k') | pkg/analyzer/test/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 162d7b76d617cf2f3655b34f0e31876e7d55e01a..5868371832ef9375b076bc0baab50676698ececb 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -3023,7 +3023,7 @@ main() {
test_inferLocalFunctionReturnType() async {
// Regression test for https://github.com/dart-lang/sdk/issues/26414
- var unit = await checkFileElement(r'''
+ var unit = await checkFile(r'''
main() {
f0() => 42;
f1() async => 42;
@@ -3040,21 +3040,20 @@ main() {
f9() => f5();
}
''');
- var fns = unit.functions[0].functions;
- expect(fns[0].type.toString(), '() → int');
- expect(fns[1].type.toString(), '() → Future<int>');
+ expect(findLocalFunction(unit, 'f0').type.toString(), '() → int');
+ expect(findLocalFunction(unit, 'f1').type.toString(), '() → Future<int>');
- expect(fns[2].type.toString(), '() → int');
- expect(fns[3].type.toString(), '() → Future<int>');
- expect(fns[4].type.toString(), '() → Iterable<int>');
- expect(fns[5].type.toString(), '() → Stream<int>');
+ expect(findLocalFunction(unit, 'f2').type.toString(), '() → int');
+ expect(findLocalFunction(unit, 'f3').type.toString(), '() → Future<int>');
+ expect(findLocalFunction(unit, 'f4').type.toString(), '() → Iterable<int>');
+ expect(findLocalFunction(unit, 'f5').type.toString(), '() → Stream<int>');
- expect(fns[6].type.toString(), '() → num');
+ expect(findLocalFunction(unit, 'f6').type.toString(), '() → num');
// Recursive cases: these infer in declaration order.
- expect(fns[7].type.toString(), '() → dynamic');
- expect(fns[8].type.toString(), '() → dynamic');
- expect(fns[9].type.toString(), '() → Stream<int>');
+ expect(findLocalFunction(unit, 'f7').type.toString(), '() → dynamic');
+ expect(findLocalFunction(unit, 'f8').type.toString(), '() → dynamic');
+ expect(findLocalFunction(unit, 'f9').type.toString(), '() → Stream<int>');
}
test_inferParameterType_setter_fromField() async {
« no previous file with comments | « pkg/analyzer/test/generated/resolver_test.dart ('k') | pkg/analyzer/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698