Chromium Code Reviews| 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 library generic_methods_dynamic_test; | |
| 6 | |
| 7 import "package:expect/expect.dart"; | |
| 8 | |
| 9 class A {} | |
| 10 | |
| 11 class B {} | |
| 12 | |
| 13 class C { | |
| 14 T fun<T>(T t) => t; | |
| 15 } | |
| 16 | |
| 17 main() { | |
| 18 B b = new B(); | |
| 19 C c = new C(); | |
| 20 dynamic obj = c; | |
| 21 | |
|
karlklose
2017/03/09 09:17:00
Use multi-tests?
c.fun<A>(b); /// 01: compile-ti
Dmitry Stefantsov
2017/03/10 13:21:53
Thanks! I put the checks for both compile-type err
| |
| 22 Expect.throws(() => obj.fun<A>(b), (e) => e is TypeError); | |
|
karlklose
2017/03/09 09:17:00
() => obj.fun<A>(b); /// 02: runtime error
eernst
2017/03/09 14:55:02
This tests one of the cases I mentioned above in g
Dmitry Stefantsov
2017/03/10 13:21:53
Probably, it should be 'obj.fun<A>(b);', otherwise
Dmitry Stefantsov
2017/03/10 13:21:53
Done.
| |
| 23 } | |
| OLD | NEW |