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

Unified Diff: tests/language/callable_test.dart

Issue 11549027: Fix type test for callable objects (issue 7338). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/callable_test.dart
===================================================================
--- tests/language/callable_test.dart (revision 0)
+++ tests/language/callable_test.dart (revision 0)
@@ -0,0 +1,25 @@
+// 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.
+
+class X {
+ call() => 42;
+}
+
+class Y {
+ call(int x) => 87;
+}
+
+typedef F(int x);
+typedef G(String y);
+
+main() {
+ X x = new X();
+ Function f = x; // Should pass checked mode test
+ Y y = new Y();
+ Function g = y; // Should pass checked mode test
+ F f0 = y; // Should pass checked mode test
+ F f1 = x; /// 00: dynamic type error, static type warning
+ G g0 = y; /// 01: dynamic type error, static type warning
+}
+
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698