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

Unified Diff: tests/language/mixin_illegal_constructor_test.dart

Issue 12038018: Disallow mixing in classes that have constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/mixin_illegal_constructor_test.dart
diff --git a/tests/language/mixin_illegal_constructor_test.dart b/tests/language/mixin_illegal_constructor_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c3891ad48f1bfcbed1a4ab327b2be63fff4bc041
--- /dev/null
+++ b/tests/language/mixin_illegal_constructor_test.dart
@@ -0,0 +1,55 @@
+// 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.
+
Johnni Winther 2013/01/22 11:46:44 There is no case where the constructor is synthesi
kasperl 2013/01/22 11:50:45 Well, that is generally the case for mixins so tha
+class M0 {
+ factory M0(a,b,c) => null;
+ factory M0.named() => null;
+}
+
+class M1 {
+ M1();
+}
+
+class M2 {
+ M2.named();
+}
+
+typedef C0 = Object with M0;
+typedef C1 = Object with M1; /// 01: compile-time error
+typedef C2 = Object with M2; /// 02: compile-time error
+typedef C3 = Object with M0, M1; /// 03: compile-time error
+typedef C4 = Object with M1, M0; /// 04: compile-time error
+typedef C5 = Object with M0, M2; /// 05: compile-time error
+typedef C6 = Object with M2, M0; /// 06: compile-time error
+
+class D0 extends Object with M0 { }
+class D1 extends Object with M1 { } /// 07: compile-time error
+class D2 extends Object with M2 { } /// 08: compile-time error
+class D3 extends Object with M0, M1 { } /// 09: compile-time error
+class D4 extends Object with M1, M0 { } /// 10: compile-time error
+class D5 extends Object with M0, M2 { } /// 11: compile-time error
+class D6 extends Object with M2, M0 { } /// 12: compile-time error
+
+main() {
+ new C0();
+ new C1(); /// 01: continued
+ new C2(); /// 02: continued
+ new C3(); /// 03: continued
+ new C4(); /// 04: continued
+ new C5(); /// 05: continued
+ new C6(); /// 06: continued
+
+ new D0();
+ new D1(); /// 07: continued
+ new D2(); /// 08: continued
+ new D3(); /// 09: continued
+ new D4(); /// 10: continued
+ new D5(); /// 11: continued
+ new D6(); /// 12: continued
+
+ new C0(1,2,3); /// 13: static type warning, runtime error
+ new C0.named(); /// 14: static type warning, runtime error
+ new D0(1,2,3); /// 15: static type warning, runtime error
+ new D0.named(); /// 16: static type warning, runtime error
+}
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698