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

Unified Diff: tests/language/generic_creation_test.dart

Issue 11092046: Complete support for type variables in new expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing quotes. Created 8 years, 2 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_creation_test.dart
diff --git a/tests/language/generic_creation_test.dart b/tests/language/generic_creation_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8aa6d29f61ab139430f1c196e2225aec55d5945b
--- /dev/null
+++ b/tests/language/generic_creation_test.dart
@@ -0,0 +1,26 @@
+// 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 A<X, Y, Z> {
+ shift() => new A<Z, X, Y>();
+ swap() => new A<Z, Y, X>();
+ first() => new A<X, X, X>();
+ last() => new A<Z, Z, Z>();
+ wrap() => new A<A<X, X, X>, A<Y, Y, Y>, A<Z, Z, Z>>();
+}
+
+class U {}
+class V {}
+class W {}
+
+sameType(a, b) => Expect.identical(a.runtimeType, b.runtimeType);
+
+main() {
+ A a = new A<U, V, W>();
+ sameType(new A<W, U, V>(), a.shift());
+ sameType(new A<W, V, U>(), a.swap());
+ sameType(new A<U, U, U>(), a.first());
+ sameType(new A<W, W, W>(), a.last());
+ sameType(new A<A<U, U, U>, A<V, V, V>, A<W, W, W>>(), a.wrap());
+}
« lib/compiler/implementation/ssa/builder.dart ('K') | « lib/compiler/implementation/ssa/builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698