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

Unified Diff: pkg/compiler/lib/src/typechecker.dart

Issue 895583006: Update yield warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 years, 10 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/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/typechecker.dart
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
index f338269b29226c612117c80bda1641c55f41f0c8..6bec813294af53a34cb635c74c37ab62e17ae22c 100644
--- a/pkg/compiler/lib/src/typechecker.dart
+++ b/pkg/compiler/lib/src/typechecker.dart
@@ -1629,15 +1629,20 @@ class TypeCheckerVisitor extends Visitor<DartType> {
DartType resultType = analyze(node.expression);
if (!node.hasStar) {
if (currentAsyncMarker.isAsync) {
- resultType =
- compiler.streamClass.thisType.createInstantiation(
- <DartType>[resultType]);
+ resultType = compiler.coreTypes.streamType(resultType);
} else {
- resultType =
- compiler.iterableClass.thisType.createInstantiation(
- <DartType>[resultType]);
+ resultType = compiler.coreTypes.iterableType(resultType);
+ }
+ } else {
+ if (currentAsyncMarker.isAsync) {
+ // The static type of expression must be assignable to Stream.
+ checkAssignable(node, resultType, compiler.coreTypes.streamType());
+ } else {
+ // The static type of expression must be assignable to Iterable.
+ checkAssignable(node, resultType, compiler.coreTypes.iterableType());
}
}
+ // The static type of the result must be assignable to the declared type.
checkAssignable(node, resultType, expectedReturnType);
return const StatementType();
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/signatures.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698