Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 interface Interface { | |
| 6 final x; | |
| 7 } | |
| 8 | |
| 9 class Abstract implements Interface { | |
| 10 String toString() => x.toString(); | |
| 11 } | |
| 12 | |
| 13 class Concrete extends Abstract { | |
| 14 get x() => 7; | |
| 15 } | |
| 16 | |
| 17 class SubConcrete extends Concrete { | |
| 18 final x; | |
| 19 SubConcrete(this.x); | |
| 20 } | |
| 21 | |
| 22 void main() { | |
| 23 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
| |
| 24 Expect.equals(x, x); | |
| 25 Expect.equals(new Concrete().toString(), '7'); | |
| 26 Expect.equals(new SubConcrete(42).toString(), '42'); | |
| 27 Expect.equals(new SubConcrete(new Concrete()).toString(), '7'); | |
| 28 } | |
| OLD | NEW |