Chromium Code Reviews| 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'); |
| + } |
| +} |