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 /** | 5 /** |
6 * This library contains an Expect class with static methods that can be used | 6 * This library contains an Expect class with static methods that can be used |
7 * for simple unit-tests. | 7 * for simple unit-tests. |
8 */ | 8 */ |
9 library expect; | 9 library expect; |
10 | 10 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 /// Annotation class for testing of dart2js. Use this as metadata on method | 400 /// Annotation class for testing of dart2js. Use this as metadata on method |
401 /// declarations to disable inlining of the annotated method. | 401 /// declarations to disable inlining of the annotated method. |
402 class NoInlining { | 402 class NoInlining { |
403 const NoInlining(); | 403 const NoInlining(); |
404 } | 404 } |
405 | 405 |
406 /// Annotation class for testing of dart2js. Use this as metadata on method | 406 /// Annotation class for testing of dart2js. Use this as metadata on method |
407 /// declarations to make the type inferrer trust the parameter and return types, | 407 /// declarations to make the type inferrer trust the parameter and return types, |
408 /// effectively asserting the runtime values will (at least) be subtypes of the | 408 /// effectively asserting the runtime values will (at least) be subtypes of the |
409 /// annotated types. | 409 /// annotated types. |
| 410 /// |
| 411 /// While the actually inferred type is guaranteed to be a subtype of the |
| 412 /// annotation, it often is more precise. In particular, if a method is only |
| 413 /// called with `null`, the inferrer will still infer null. To ensure that |
| 414 /// the annotated type is also the inferred type, additionally use |
| 415 /// [AssumeDynamic]. |
410 class TrustTypeAnnotations { | 416 class TrustTypeAnnotations { |
411 const TrustTypeAnnotations(); | 417 const TrustTypeAnnotations(); |
412 } | 418 } |
413 | 419 |
414 /// Annotation class for testing of dart2js. Use this as metadata on method | 420 /// Annotation class for testing of dart2js. Use this as metadata on method |
415 /// declarations to disable closed world assumptions on parameters, effectively | 421 /// declarations to disable closed world assumptions on parameters, effectively |
416 /// assuming that the runtime arguments could be any value. | 422 /// assuming that the runtime arguments could be any value. Note that the |
| 423 /// constraints due to [TrustTypeAnnotations] still apply. |
417 class AssumeDynamic { | 424 class AssumeDynamic { |
418 const AssumeDynamic(); | 425 const AssumeDynamic(); |
419 } | 426 } |
OLD | NEW |