| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 void main() { | 5 // This checks that it is possible to have a method named negate as |
| 6 var foo = new Foo(); | 6 // well as unary- operator. |
| 7 var bar = new Bar(); /// 01: compile-time error | 7 |
| 8 class Foo { |
| 9 operator-() => 42; |
| 10 negate() => 87; |
| 8 } | 11 } |
| 9 | 12 |
| 10 class Foo { | 13 main() { |
| 11 factory Foo() => null; | 14 Expect.equals(42, -new Foo()); |
| 15 Expect.equals(87, new Foo().negate()); |
| 12 } | 16 } |
| 13 | |
| 14 class Bar extends Foo { | |
| 15 Bar(); /// 01: continued | |
| 16 } | |
| OLD | NEW |