OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 class A { | 7 class A { |
8 foo(required1, { named1: 499}) => -(required1 + named1 * 3); | 8 foo(required1, {named1: 499}) => -(required1 + named1 * 3); |
9 bar(required1, required2, { named1: 13, named2: 17}) | 9 bar(required1, required2, {named1: 13, named2: 17}) => |
10 => -(required1 + required2 * 3 + named1 * 5 + named2 * 7); | 10 -(required1 + required2 * 3 + named1 * 5 + named2 * 7); |
11 gee({named1: 31}) => -named1; | 11 gee({named1: 31}) => -named1; |
12 } | 12 } |
13 | 13 |
14 class B extends A { | 14 class B extends A { |
15 foo(required1 | 15 foo( |
| 16 required1 |
16 /* // //# 00: static type warning | 17 /* // //# 00: static type warning |
17 , { named1: 499 } | 18 , |
| 19 {named1: 499} |
18 */ // //# 00: static type warning | 20 */ // //# 00: static type warning |
19 ) { | 21 ) { |
20 return required1; | 22 return required1; |
21 } | 23 } |
22 | 24 |
23 bar(required1, required2, | 25 bar(required1, required2, |
24 { named1: 13 | 26 {named1: 13 |
25 /* // //# 01: static type warning | 27 /* // //# 01: static type warning |
26 , named2: 17 | 28 , |
| 29 named2: 17 |
27 */ // //# 01: static type warning | 30 */ // //# 01: static type warning |
28 }) { | 31 }) { |
29 return required1 + required2 * 3 + named1 * 5; | 32 return required1 + required2 * 3 + named1 * 5; |
30 } | 33 } |
31 | 34 |
32 gee({named2: 11 | 35 gee( |
| 36 {named2: 11 |
33 /* // //# 02: static type warning | 37 /* // //# 02: static type warning |
34 , named1: 31 | 38 , |
| 39 named1: 31 |
35 */ // //# 02: static type warning | 40 */ // //# 02: static type warning |
36 }) { | 41 }) { |
37 return named2 * 99; | 42 return named2 * 99; |
38 } | 43 } |
39 } | 44 } |
40 | 45 |
41 main() { | 46 main() { |
42 var b = new B(); | 47 var b = new B(); |
43 Expect.equals(499, b.foo(499)); | 48 Expect.equals(499, b.foo(499)); |
44 Expect.equals(1 + 3 * 3 + 5 * 5, b.bar(1, 3, named1: 5)); | 49 Expect.equals(1 + 3 * 3 + 5 * 5, b.bar(1, 3, named1: 5)); |
45 Expect.equals(1 + 3 * 3 + 13 * 5, b.bar(1, 3)); | 50 Expect.equals(1 + 3 * 3 + 13 * 5, b.bar(1, 3)); |
46 Expect.equals(3 * 99, b.gee(named2: 3)); | 51 Expect.equals(3 * 99, b.gee(named2: 3)); |
47 Expect.equals(11 * 99, b.gee()); | 52 Expect.equals(11 * 99, b.gee()); |
48 } | 53 } |
OLD | NEW |