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

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: SubConcrete should extend Concrete 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..58fb9ea941ab974a8a6d3e5c8a65b278edf6d321
--- /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 {
+ String toString() => x.toString();
+}
+
+class Concrete extends Abstract {
+ get x() => 7;
+}
+
+class SubConcrete extends Concrete {
+ final x;
+ SubConcrete(this.x);
+}
+
+void main() {
+ var x = new Abstract(); /// 01: static type error
gbracha 2011/11/02 19:01:45 Why do you expect a static warning here? Class Abs
ahe 2011/11/02 19:03:57 Good point. I should add the abstract keyword to t
+ Expect.equals(x, x);
+ Expect.equals(new Concrete().toString(), '7');
+ 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