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

Unified Diff: tests/language/type_promotion_assign_test.dart

Issue 26232003: Support type promotion in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated to latest spec change Created 7 years, 2 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 | « tests/language/language_analyzer.status ('k') | tests/language/type_promotion_closure_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/type_promotion_assign_test.dart
diff --git a/tests/language/type_promotion_assign_test.dart b/tests/language/type_promotion_assign_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..51f0ee5d4b7dc8141fabeec913d56a1da7fbf2bf
--- /dev/null
+++ b/tests/language/type_promotion_assign_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test type promotion of assigned locals.
+
+class A {
+ var a = "a";
+}
+class B extends A {
+ var b = "b";
+}
+class C extends B {
+ var c = "c";
+}
+class D extends A {
+ var d = "d";
+}
+class E implements C, D {
+ var a = "";
+ var b = "";
+ var c = "";
+ var d = "";
+}
+
+void main() {
+ A a = new E();
+ if (a is B) {
+ print(a.a);
+ print(a.b); /// 01: static type warning
+ a = null;
+ }
+ if (a is B) {
+ a = null;
+ print(a.a);
+ print(a.b); /// 02: static type warning
+ }
+ if (a is B) {
+ print(a.a);
+ print(a.b); /// 03: static type warning
+ {
+ a = null;
+ }
+ print(a.a);
+ print(a.b); /// 04: static type warning
+ }
+}
« no previous file with comments | « tests/language/language_analyzer.status ('k') | tests/language/type_promotion_closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698