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

Unified Diff: tests/language_2/generic_field_mixin6_test.dart

Issue 3008573002: Migrate test block 113 to Dart 2.0. (Closed)
Patch Set: Created 3 years, 4 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_2/generic_field_mixin6_test.dart
diff --git a/tests/language_2/generic_field_mixin6_test.dart b/tests/language_2/generic_field_mixin6_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..09282d7bc869ff894611bba73af29dd3e8e5730d
--- /dev/null
+++ b/tests/language_2/generic_field_mixin6_test.dart
@@ -0,0 +1,34 @@
+// 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.
+
+// Test that generic types in mixins are handled.
+
+import 'package:expect/expect.dart';
+
+class M<T> {
+ T field = 0; //# 01: compile-time error
+}
+
+class A<U> {}
+
+class C1<V> = Object with M<V>;
+class C2 = Object with M<int>;
+class C3 = Object with M<String>;
+
+main() {
+ checkNoDynamicTypeError(() => new C1<int>());
Jennifer Messerly 2017/08/25 21:59:48 i'm not sure this is testing anything now, since t
jcollins 2017/08/29 15:41:06 agreed, this is better. Done.
+ checkNoDynamicTypeError(() => new C1<String>());
+ checkNoDynamicTypeError(() => new C2());
+ checkNoDynamicTypeError(() => new C3());
+}
+
+/// Checks that no dynamic type error is thrown when [f] is executed regardless
+/// of execution mode.
+void checkNoDynamicTypeError(f()) {
+ try {
+ f();
+ } on TypeError {
+ Expect.fail('Unexpected type error');
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698