OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, 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 // Test that if the type of a parameter of a generic method is a type parameter, |
| 6 // the type of the passed argument is checked at runtime if the receiver is |
| 7 // dynamic, and an exception is thrown. |
| 8 |
| 9 library generic_methods_dynamic_simple_error_test; |
| 10 |
| 11 import "test_base.dart"; |
| 12 |
| 13 class A {} |
| 14 |
| 15 class B {} |
| 16 |
| 17 class C { |
| 18 T foo<T>(T t) => t; |
| 19 } |
| 20 |
| 21 main() { |
| 22 B b = new B(); |
| 23 C c = new C(); |
| 24 dynamic obj = c; |
| 25 |
| 26 expectThrows(() => obj.foo<A>(b), (e) => e is TypeError); |
| 27 } |
OLD | NEW |