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

Unified Diff: dart/tests/language/type_variable_function_type_test.dart

Issue 50313007: Implement dynamic function checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r30897. Created 7 years 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: dart/tests/language/type_variable_function_type_test.dart
diff --git a/dart/tests/language/type_variable_function_type_test.dart b/dart/tests/language/type_variable_function_type_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6c2d51586eea2697d2ab5c3112a76d0b98076d68
--- /dev/null
+++ b/dart/tests/language/type_variable_function_type_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2013, 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.
+
+import 'package:expect/expect.dart';
+
+typedef T Func<T>();
+
+class Foo<S> {
+ m(x) => x is Func<S>;
+}
+
+class Bar<T> {
+ f() {
+ T local() {}
+ return local;
+ }
+}
+
+void main() {
+ var x = new Foo<List<String>>();
+ if (new DateTime.now().millisecondsSinceEpoch == 42) x = new Foo<int>();
+ Expect.isFalse(x.m(new Bar<String>().f()));
+ Expect.isTrue(x.m(new Bar<List<String>>().f()));
+}

Powered by Google App Engine
This is Rietveld 408576698