Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1824)

Unified Diff: tests/language_strong/generic_methods_boundaries_test.dart

Issue 2737933002: Add tests for generic methods in strong mode (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/language_strong/generic_methods_boundaries_test.dart
diff --git a/tests/language_strong/generic_methods_boundaries_test.dart b/tests/language_strong/generic_methods_boundaries_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5b5e19d73b0e69a75af503d3acf2484b5b31a060
--- /dev/null
+++ b/tests/language_strong/generic_methods_boundaries_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library generic_methods_boundaries_test;
+
+import "package:expect/expect.dart";
+
+class A {
+ int answer() => 42;
+}
+
+class B {
+ int answer() => 42;
+}
+
+class C {
+ 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.
+}
+
+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
+ dynamic obj = new C();
+ 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
+}

Powered by Google App Engine
This is Rietveld 408576698