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_boundaries_test; | |
| 6 | |
| 7 import "package:expect/expect.dart"; | |
| 8 | |
| 9 class A { | |
| 10 int answer() => 42; | |
| 11 } | |
| 12 | |
| 13 class B { | |
| 14 int answer() => 42; | |
| 15 } | |
| 16 | |
| 17 class C { | |
| 18 int fun<T extends A>(T t) => t.answer(); | |
|
karlklose
2017/03/09 09:16:59
Remove answer and replace it with some integer.
Dmitry Stefantsov
2017/03/10 13:21:52
Done.
| |
| 19 } | |
| 20 | |
| 21 main() { | |
|
Leaf
2017/03/09 05:51:18
I don't know what the conventions are for these te
karlklose
2017/03/09 09:16:59
Agreed, please add a short comment in the beginnin
Dmitry Stefantsov
2017/03/10 13:21:52
Yes, that's a good idea. I've added comments that
| |
| 22 dynamic obj = new C(); | |
| 23 Expect.throws(() => obj.fun<B>(new B()), (e) => e is TypeError); | |
|
eernst
2017/03/09 14:55:02
We give type argument B which is a violation of th
Dmitry Stefantsov
2017/03/10 13:21:52
Yes, I agree. I removed the 'answer' methods, beca
| |
| 24 } | |
| OLD | NEW |