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

Unified Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 895673005: Add static type checking of "yield*" statements to analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix tests. Created 5 years, 11 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/generated/non_error_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 4a6948ac8778e64c1691bd6215e2cfa1a24100ef..12f51926f5e50787766dfce83ad5ee40a113a428 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -1341,21 +1341,21 @@ export 'lib1.dart';''');
verify([source]);
}
- void test_extraPositionalArguments_Function() {
+ void test_extraPositionalArguments_function() {
Source source = addSource(r'''
-f(Function a) {
- a(1, 2);
+f(p1, p2) {}
+main() {
+ f(1, 2);
}''');
resolve(source);
assertNoErrors(source);
verify([source]);
}
- void test_extraPositionalArguments_function() {
+ void test_extraPositionalArguments_Function() {
Source source = addSource(r'''
-f(p1, p2) {}
-main() {
- f(1, 2);
+f(Function a) {
+ a(1, 2);
}''');
resolve(source);
assertNoErrors(source);
@@ -5079,6 +5079,155 @@ f() async* {
verify([source]);
}
+ void test_yield_each_async_dynamic_to_dynamic() {
+ Source source = addSource('''
+f() async* {
+ yield* g();
+}
+g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_async_dynamic_to_stream() {
+ Source source = addSource('''
+import 'dart:async';
+Stream f() async* {
+ yield* g();
+}
+g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_async_dynamic_to_typed_stream() {
+ Source source = addSource('''
+import 'dart:async';
+Stream<int> f() async* {
+ yield* g();
+}
+g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_async_stream_to_dynamic() {
+ Source source = addSource('''
+import 'dart:async';
+f() async* {
+ yield* g();
+}
+Stream g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_async_typed_stream_to_dynamic() {
+ Source source = addSource('''
+import 'dart:async';
+f() async* {
+ yield* g();
+}
+Stream<int> g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_async_typed_stream_to_typed_stream() {
+ Source source = addSource('''
+import 'dart:async';
+Stream<int> f() async* {
+ yield* g();
+}
+Stream<int> g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_dynamic_to_dynamic() {
+ Source source = addSource('''
+f() sync* {
+ yield* g();
+}
+g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_dynamic_to_iterable() {
+ Source source = addSource('''
+Iterable f() sync* {
+ yield* g();
+}
+g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_dynamic_to_typed_iterable() {
+ Source source = addSource('''
+Iterable<int> f() sync* {
+ yield* g();
+}
+g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_iterable_to_dynamic() {
+ Source source = addSource('''
+f() sync* {
+ yield* g();
+}
+Iterable g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_typed_iterable_to_dynamic() {
+ Source source = addSource('''
+f() sync* {
+ yield* g();
+}
+Iterable<int> g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_typed_iterable_to_typed_iterable() {
+ Source source = addSource('''
+Iterable<int> f() sync* {
+ yield* g();
+}
+Iterable<int> g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_yield_sync_to_dynamic_type() {
Source source = addSource('''
dynamic f() sync* {
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/test/generated/static_type_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698