Chromium Code Reviews| 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'); |
| +} |