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

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

Issue 895113002: Add static type checking of "yield" statements to analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 30b36a42f14793caf64bd01ac3a1e0a65a2277b0..4a6948ac8778e64c1691bd6215e2cfa1a24100ef 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -2765,6 +2765,28 @@ main() {
}'''], <ErrorCode>[]);
}
+ void test_local_generator_async() {
+ Source source = addSource('''
+f() {
+ return () async* { yield 0; };
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_local_generator_sync() {
+ Source source = addSource('''
+f() {
+ return () sync* { yield 0; };
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_mapKeyTypeNotAssignable() {
Source source = addSource("var v = <String, int > {'a' : 1};");
resolve(source);
@@ -5011,6 +5033,96 @@ class A {
verify([source]);
}
+ void test_yield_async_to_dynamic_type() {
+ Source source = addSource('''
+dynamic f() async* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_async_to_generic_type() {
+ Source source = addSource('''
+import 'dart:async';
+Stream f() async* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_async_to_parameterized_type() {
+ Source source = addSource('''
+import 'dart:async';
+Stream<int> f() async* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_async_to_untyped() {
+ Source source = addSource('''
+f() async* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_sync_to_dynamic_type() {
+ Source source = addSource('''
+dynamic f() sync* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_sync_to_generic_type() {
+ Source source = addSource('''
+Iterable f() sync* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_sync_to_parameterized_type() {
+ Source source = addSource('''
+Iterable<int> f() sync* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_yield_sync_to_untyped() {
+ Source source = addSource('''
+f() sync* {
+ yield 3;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_yieldEachInNonGenerator_asyncStar() {
Source source = addSource(r'''
f() async* {
« no previous file with comments | « pkg/analyzer/lib/src/generated/testing/test_type_provider.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698