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

Unified Diff: pkg/analyzer/test/generated/static_type_warning_code_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/static_type_warning_code_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index f7c50e5806cfcd73cb71125c0f7d69728be9b742..b2c1016215d8b8c6fb35899d7a2f93f8d57f4d7b 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -1688,6 +1688,31 @@ Stream<int> f() async* {
verify([source]);
}
+ void test_yield_each_async_to_mistyped_stream() {
+ Source source = addSource('''
+import 'dart:async';
+Stream<int> f() async* {
+ yield* g();
+}
+Stream<String> g() => null;
+''');
+ resolve(source);
+ assertErrors(source, [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
+ verify([source]);
+ }
+
+ void test_yield_each_sync_to_mistyped_iterable() {
+ Source source = addSource('''
+Iterable<int> f() async* {
+ yield* g();
+}
+Iterable<String> g() => null;
+''');
+ resolve(source);
+ assertErrors(source, [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
+ verify([source]);
+ }
+
void test_yield_sync_to_basic_type() {
Source source = addSource('''
int f() sync* {
« no previous file with comments | « pkg/analyzer/test/generated/non_error_resolver_test.dart ('k') | tests/language/async_await_syntax_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698