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

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

Issue 2654733003: Make Stream abstract as it is in the actual SDK. (Closed)
Patch Set: Created 3 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/src/task/strong/checker_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 9401f1a6a52ed166afadc16ec48626094703c90a..c03aa6a029d8b8db0a14543a2cfed050c44f2147 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -40,21 +40,26 @@ class CheckerTest {
void test_awaitForInCastsStreamElementToVariable() {
checkFile('''
import 'dart:async';
+
+abstract class MyStream<T> extends Stream<T> {
+ factory MyStream() => null;
+}
+
main() async {
// Don't choke if sequence is not stream.
await for (var i in /*error:FOR_IN_OF_INVALID_TYPE*/1234) {}
// Dynamic cast.
- await for (String /*info:DYNAMIC_CAST*/s in new Stream<dynamic>()) {}
+ await for (String /*info:DYNAMIC_CAST*/s in new MyStream<dynamic>()) {}
// Identity cast.
- await for (String s in new Stream<String>()) {}
+ await for (String s in new MyStream<String>()) {}
// Untyped.
- await for (var s in new Stream<String>()) {}
+ await for (var s in new MyStream<String>()) {}
// Downcast.
- await for (int /*info:DOWN_CAST_IMPLICIT*/i in new Stream<num>()) {}
+ await for (int /*info:DOWN_CAST_IMPLICIT*/i in new MyStream<num>()) {}
}
''');
}
@@ -981,16 +986,22 @@ import 'dart:async';
dynamic x;
+Stream<int> intStream;
+
+abstract class MyStream<T> extends Stream<T> {
+ factory MyStream() => null;
+}
+
bar1() async* { yield x; }
Stream bar2() async* { yield x; }
Stream<int> bar3() async* { yield /*info:DYNAMIC_CAST*/x; }
-Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/new Stream<int>(); }
+Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/intStream; }
baz1() async* { yield* /*info:DYNAMIC_CAST*/x; }
Stream baz2() async* { yield* /*info:DYNAMIC_CAST*/x; }
Stream<int> baz3() async* { yield* /*info:DYNAMIC_CAST*/x; }
-Stream<int> baz4() async* { yield* new Stream<int>(); }
-Stream<int> baz5() async* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new Stream(); }
+Stream<int> baz4() async* { yield* intStream; }
+Stream<int> baz5() async* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new MyStream(); }
''');
}
« no previous file with comments | « pkg/analyzer/test/src/context/mock_sdk.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698