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

Unified Diff: tests/compiler/dart2js/mixin_typevariable_test.dart

Issue 88153003: Add synthetic type variables to unnamed mixin applications. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unneeded handling of unnamed mixin applications. Created 7 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/compiler/dart2js/mixin_typevariable_test.dart
diff --git a/tests/compiler/dart2js/mixin_typevariable_test.dart b/tests/compiler/dart2js/mixin_typevariable_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4a26c81dfc2232800b9b46852207bc2149992940
--- /dev/null
+++ b/tests/compiler/dart2js/mixin_typevariable_test.dart
@@ -0,0 +1,73 @@
+// 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.
+
+library mixin_typevariable_test;
+
+import 'package:expect/expect.dart';
+import "package:async_helper/async_helper.dart";
+import 'type_test_helper.dart';
+import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart';
+import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart"
+ show Element, ClassElement;
+
+void main() {
+ testMixinSupertypes();
+}
+
+void testMixinSupertypes() {
+ asyncTest(() => TypeEnvironment.create(r"""
+ class S<S_T> {}
+ class M1<M1_T> {}
+ class M2<M2_T> {}
+ class M3<M3_T> {}
+
+ class C1<C1_T> extends S<C1_T> with M1<C1_T>, M2<C1_T>, M3<C1_T> {}
+ class C2<C2_T> = S<C2_T> with M1<C2_T>, M2<C2_T>, M3<C2_T>;
+ """).then((env) {
+
+ ClassElement Object = env.getElement('Object');
+ ClassElement S = env.getElement('S');
+ ClassElement M1 = env.getElement('M1');
+ ClassElement M2 = env.getElement('M2');
+ ClassElement M3 = env.getElement('M3');
+ ClassElement C1 = env.getElement('C1');
+ ClassElement C2 = env.getElement('C2');
+
+ ClassElement C1_S_M1_M2_M3 = C1.superclass;
+ ClassElement C1_S_M1_M2 = C1_S_M1_M2_M3.superclass;
+ ClassElement C1_S_M1 = C1_S_M1_M2.superclass;
+
+ ClassElement C2_S_M1_M2_M3 = C2.superclass;
+ ClassElement C2_S_M1_M2 = C2_S_M1_M2_M3.superclass;
+ ClassElement C2_S_M1 = C2_S_M1_M2.superclass;
+
+ void testSupertypes(ClassElement element) {
+ if (element != Object) {
+ Expect.isTrue(element.typeVariables.slowLength() == 1);
+ Expect.equals(element,
+ element.typeVariables.head.element.enclosingElement);
+ }
+ for (InterfaceType supertype in element.allSupertypesAndSelf.types) {
+ if (!supertype.typeArguments.isEmpty) {
+ Expect.equals(element.typeVariables, supertype.typeArguments);
+ } else {
+ Expect.equals(Object, supertype.element);
+ }
+ }
+ }
+
+ testSupertypes(Object);
+ testSupertypes(S);
+ testSupertypes(M1);
+ testSupertypes(M2);
+ testSupertypes(C1_S_M1);
+ testSupertypes(C1_S_M1_M2);
+ testSupertypes(C1_S_M1_M2_M3);
+ testSupertypes(C1);
+ testSupertypes(C2_S_M1);
+ testSupertypes(C2_S_M1_M2);
+ testSupertypes(C2_S_M1_M2_M3);
+ testSupertypes(C2);
+ }));
+}

Powered by Google App Engine
This is Rietveld 408576698