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

Unified Diff: tests/language/first_class_types_constants_test.dart

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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/first_class_types_constants_test.dart
diff --git a/tests/language/first_class_types_constants_test.dart b/tests/language/first_class_types_constants_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6a4c4d4ae12729e82fd1f75d0d67eb3ec1650ef0
--- /dev/null
+++ b/tests/language/first_class_types_constants_test.dart
@@ -0,0 +1,28 @@
+// 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 C<T> {
+ final T t;
+ const C(this.t);
+}
+
+typedef int Fun(bool, String);
+
+const c0 = C;
+const c1 = const C(C);
+const c2 = Fun;
+const c3 = const C(Fun);
+
+main() {
+ Expect.identical(C, C);
+ Expect.identical(C, c0);
+ Expect.identical(c1, c1);
+ Expect.notEquals(c0, c1);
+ Expect.notEquals(c1, c2);
+ Expect.identical(c1.t, c0);
+ Expect.notEquals(C, Fun);
+ Expect.identical(Fun, Fun);
+ Expect.identical(Fun, c2);
+ Expect.identical(c3.t, c2);
+}

Powered by Google App Engine
This is Rietveld 408576698