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

Unified Diff: tests/language/generic_function_typedef_test.dart

Issue 2707933002: Tests for `void`.
Patch Set: More tests. Created 3 years, 10 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/generic_function_typedef_test.dart
diff --git a/tests/language/generic_function_typedef_test.dart b/tests/language/generic_function_typedef_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..eb8fb183d0d5cc8f5793cb8c6ad5149daea9cdf9
--- /dev/null
+++ b/tests/language/generic_function_typedef_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2012, 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.
+// Dart test for a function type test that cannot be eliminated at compile time.
+
+import "package:expect/expect.dart";
+
+class A {
Lasse Reichstein Nielsen 2017/02/21 09:37:03 Isn't used.
+}
+
+typedef F<T> = Function<S>(List<S> list, Function<A>(A), T);
Lasse Reichstein Nielsen 2017/02/21 09:37:03 This defines a generic function that requires a ge
+
+foo(List<dynamic> x, bar(String y), int z) {}
+foo2(List<int> x, bar(String y), int z) {}
Lasse Reichstein Nielsen 2017/02/21 09:37:03 Neither of these functions are generic or take a g
eernst 2017/02/21 13:39:11 I believe we haven't yet written any CLs for exten
+
+main() {
+ Expect.isTrue(foo is F);
+ Expect.isTrue(foo is F<int>);
+ Expect.isFalse(foo is F<bool>);
+
+ Expect.isTrue(foo2 is F);
+ Expect.isTrue(foo2 is F<int>);
+ Expect.isFalse(foo2 is F<bool>);
+}

Powered by Google App Engine
This is Rietveld 408576698