OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 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 | 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 // VMOptions=--checked | 4 // VMOptions=--checked |
5 // | 5 // |
6 // Dart test program for testing optional named parameters in type tests. | 6 // Dart test program for testing optional named parameters in type tests. |
7 | 7 |
8 main() { | 8 main() { |
9 Function anyFunction; | 9 Function anyFunction; |
10 void acceptFunNumOptBool(void funNumOptBool(num n, {bool b})) { }; | 10 void acceptFunNumOptBool(void funNumOptBool(num n, {bool b})) { }; |
11 void funNum(num n) { }; | 11 void funNum(num n) { }; |
12 void funNumBool(num n, bool b) { }; | 12 void funNumBool(num n, bool b) { }; |
13 void funNumOptBool(num n, {bool b: true}) { }; | 13 void funNumOptBool(num n, {bool b: true}) { }; |
14 void funNumOptBoolX(num n, {bool x: true}) { }; | 14 void funNumOptBoolX(num n, {bool x: true}) { }; |
15 anyFunction = funNum; | 15 anyFunction = funNum; |
16 anyFunction = funNumBool; | 16 anyFunction = funNumBool; |
17 anyFunction = funNumOptBool; | 17 anyFunction = funNumOptBool; |
18 anyFunction = funNumOptBoolX; | 18 anyFunction = funNumOptBoolX; |
19 acceptFunNumOptBool(funNumOptBool); | 19 acceptFunNumOptBool(funNumOptBool); |
20 acceptFunNumOptBool(funNum); /// 01: runtime error | 20 acceptFunNumOptBool(funNum); //# 01: runtime error |
21 acceptFunNumOptBool(funNumBool); /// 02: static type warning, runtime error | 21 acceptFunNumOptBool(funNumBool); //# 02: static type warning, runtime error |
22 acceptFunNumOptBool(funNumOptBoolX); /// 03: static type warning, runtime err
or | 22 acceptFunNumOptBool(funNumOptBoolX); //# 03: static type warning, runtime err
or |
23 } | 23 } |
OLD | NEW |