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

Unified Diff: tests/language/type_check_const_function_typedef2_test.dart

Issue 132313012: Fix typechecks for constant assignments of function to typedefs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file for analyzer. Created 6 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
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/language/type_check_const_function_typedef_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/type_check_const_function_typedef2_test.dart
diff --git a/tests/language/type_check_const_function_typedef2_test.dart b/tests/language/type_check_const_function_typedef2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..fa9609b565f527ad7cb8ddbbaaefdc762a7d1ca6
--- /dev/null
+++ b/tests/language/type_check_const_function_typedef2_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2014, 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.
+
+// Tests that typechecks on const objects with typedefs work.
+
+import "package:expect/expect.dart";
+
+typedef String Int2String(int x);
+
+class A {
+ final Int2String f;
+ const A(this.f);
+}
+
+int /// 00: compile-time error
+foo(
+String /// 00: continued
+x) => 499;
+
+const a = const A(foo);
+
+main() {
+ Expect.equals(499, a.f(499));
+}
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/language/type_check_const_function_typedef_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698