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

Unified Diff: dart/tests/language/src/ImplicitThisTest.dart

Issue 8438032: Test implicit this on fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 | « dart/tests/language/language.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/language/src/ImplicitThisTest.dart
diff --git a/dart/tests/language/src/ImplicitThisTest.dart b/dart/tests/language/src/ImplicitThisTest.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5e286382e7b61dde6cb7387d9087939578749ed8
--- /dev/null
+++ b/dart/tests/language/src/ImplicitThisTest.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2011, 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.
+
+interface Interface {
+ final x;
+}
+
+class Abstract implements Interface {
kasperl 2011/11/02 09:03:00 Maybe add a comment here. Something like: If you s
+ String toString() => x.toString();
+}
+
+class Concrete extends Abstract {
+ get x() => 7;
+}
+
+class SubConcrete extends Abstract {
kasperl 2011/11/02 09:03:00 How about ConcreteA and ConcreteB? They are not re
ahe 2011/11/02 19:03:57 But they are, I just subclassed the wrong class. G
+ final x;
+ SubConcrete(this.x);
+}
+
+void main() {
+ var x = new Abstract(); /// 01: static type error
+ Expect.equals(x, x);
+ Expect.equals(new Concrete().toString(), '7');
kasperl 2011/11/02 09:03:00 expected, actual
+ Expect.equals(new SubConcrete(42).toString(), '42');
+ Expect.equals(new SubConcrete(new Concrete()).toString(), '7');
+}
« no previous file with comments | « dart/tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698