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

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

Issue 1036233006: Issue 20144. Reset propagated type if one of the 'if' branches changes it to a different one. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index cc53c7f3777b8a8329c14e6b12c4e7b1c208705c..9d9a8d02cd76995a0770e08f25359081c97c9bb2 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -12749,6 +12749,54 @@ f() {
expect(typeArguments[1], same(typeProvider.dynamicType));
}
+ void test_mergePropagatedTypes_afterIfThen_different() {
+ _assertTypeOfMarkedExpression(r'''
+main() {
+ var v = 0;
+ if (v != null) {
+ v = '';
+ }
+ return v; // marker
+}''', null, null);
+ }
+
+ void test_mergePropagatedTypes_afterIfThen_same() {
+ _assertTypeOfMarkedExpression(r'''
+main() {
+ var v = 1;
+ if (v != null) {
+ v = 2;
+ }
+ return v; // marker
+}''', null, typeProvider.intType);
+ }
+
+ void test_mergePropagatedTypes_afterIfThenElse_different() {
+ _assertTypeOfMarkedExpression(r'''
+main() {
+ var v = 1;
+ if (v != null) {
+ v = 2;
+ } else {
+ v = '3';
+ }
+ return v; // marker
+}''', null, null);
+ }
+
+ void test_mergePropagatedTypes_afterIfThenElse_same() {
+ _assertTypeOfMarkedExpression(r'''
+main() {
+ var v = 1;
+ if (v != null) {
+ v = 2;
+ } else {
+ v = 3;
+ }
+ return v; // marker
+}''', null, typeProvider.intType);
+ }
+
void test_mergePropagatedTypesAtJoinPoint_4() {
// https://code.google.com/p/dart/issues/detail?id=19929
_assertTypeOfMarkedExpression(r'''
@@ -13007,9 +13055,7 @@ main() {
if (expectedStaticType != null) {
expect(identifier.staticType, expectedStaticType);
}
- if (expectedPropagatedType != null) {
- expect(identifier.propagatedType, expectedPropagatedType);
- }
+ expect(identifier.propagatedType, expectedPropagatedType);
}
/**
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698