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

Unified Diff: tests/language/initializing_formal_promotion_test.dart

Issue 2332253003: Corrects tests/language/initializing_formal_promotion_test.dart. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/initializing_formal_promotion_test.dart
diff --git a/tests/language/initializing_formal_promotion_test.dart b/tests/language/initializing_formal_promotion_test.dart
index 5f0a3b66c590fe67e8114a1ef9dcfdcf18008f22..89ec79ecc833e02d352a45e724837e25e53b11d3 100644
--- a/tests/language/initializing_formal_promotion_test.dart
+++ b/tests/language/initializing_formal_promotion_test.dart
@@ -11,12 +11,8 @@ class B {}
class A {
B x, y;
- A(this.x) {
- // Promote to subtype.
- if (x is C) y = x.x;
- // Promotion fails, not a subtype.
- if (x is A) y = x;
- }
+ // Promotion occurs for the initializing formal because C <: B.
+ A(this.x) : y = (x is C) ? x.x : x;
}
class C extends A implements B {
@@ -24,8 +20,8 @@ class C extends A implements B {
}
main() {
- C c2 = new C(null);
- C cc = new C(c2);
- Expect.equals(c2.y, null);
- Expect.equals(cc.y, c2);
+ C c = new C(null);
+ C cc = new C(c);
+ Expect.equals(c.y, null);
+ Expect.equals(cc.y, null);
}
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698