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

Unified Diff: tests/language/generic_function_typedef2_test.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. 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_typedef2_test.dart
diff --git a/tests/language/generic_function_typedef2_test.dart b/tests/language/generic_function_typedef2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a5698bd59512c6d724df98f35592d105ed221caa
--- /dev/null
+++ b/tests/language/generic_function_typedef2_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
ahe 2017/04/27 13:28:15 :-)
floitsch 2017/04/27 13:30:14 done in https://codereview.chromium.org/2849523002
+// 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 {}
+
+typedef int F();
+
+typedef G = F; /// 00: compile-time error
+typedef H = int; /// 01: compile-time error
+typedef I = A; /// 02: compile-time error
+typedef J = List<int>; /// 03: compile-time error
+typedef K = Function(Function<A>(A
+ <int> /// 04: static type warning
+ ));
+typedef L = Function({
+ /* /// 05: compile-time error
+ bool
+ */ /// 05: compile-time error
+ x});
+
+typedef M = Function({
+ /* /// 06: compile-time error
+ bool
+ */ /// 06: compile-time error
+ int});
+
+foo({bool int}) {}
+main() {
+ bool b = true;
+ Expect.isFalse(b is G); /// 00: continued
+ Expect.isFalse(b is H); /// 01: continued
+ Expect.isFalse(b is I); /// 02: continued
+ Expect.isFalse(b is J); /// 03: continued
+ Expect.isFalse(b is K); /// 04: continued
+ Expect.isFalse(b is L);
+ Expect.isFalse(b is M);
+ Expect.isTrue(foo is M);
+}

Powered by Google App Engine
This is Rietveld 408576698