Chromium Code Reviews| Index: pkg/analyzer/test/generated/strong_mode_test.dart |
| diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart |
| index 99a2f4b18f5a5c30ed1b54189972bd32c478120d..1ec9a30cc60ed61994214d2f70b53946a7426fc0 100644 |
| --- a/pkg/analyzer/test/generated/strong_mode_test.dart |
| +++ b/pkg/analyzer/test/generated/strong_mode_test.dart |
| @@ -1959,6 +1959,96 @@ void test() { |
| expectIdentifierType('cc', "C<int, B<int>, B<dynamic>>"); |
| } |
|
Leaf
2017/01/20 20:31:53
Nice! Can you add a couple of tests for the gener
scheglov
2017/01/21 02:11:23
Done.
|
| + test_instantiateToBounds_error_recursion() async { |
| + String code = r''' |
| +class C<T0 extends List<T1>, T1 extends List<T0>> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code, noErrors: false); |
| + assertErrors(testSource, [StrongModeCode.UNABLE_INSTANTIATE_TO_BOUNDS]); |
| + expectIdentifierType('c;', 'C<dynamic, dynamic>'); |
| + } |
| + |
| + test_instantiateToBounds_error_recursion_self() async { |
| + String code = r''' |
| +class C<T extends C<T>> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code, noErrors: false); |
| + assertErrors(testSource, [StrongModeCode.UNABLE_INSTANTIATE_TO_BOUNDS]); |
| + expectIdentifierType('c;', 'C<dynamic>'); |
| + } |
| + |
| + test_instantiateToBounds_error_recursion_self2() async { |
| + String code = r''' |
| +class A<E> {} |
| +class C<T extends A<T>> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code, noErrors: false); |
| + assertErrors(testSource, [StrongModeCode.UNABLE_INSTANTIATE_TO_BOUNDS]); |
| + expectIdentifierType('c;', 'C<dynamic>'); |
| + } |
| + |
| + test_instantiateToBounds_ok_referenceOther_after() async { |
| + String code = r''' |
| +class C<T0 extends T1, T1 extends int> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code); |
| + assertNoErrors(testSource); |
| + expectIdentifierType('c;', 'C<int, int>'); |
| + } |
| + |
| + test_instantiateToBounds_ok_referenceOther_after2() async { |
| + String code = r''' |
| +class C<T0 extends Map<T1, T1>, T1 extends int> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code); |
| + assertNoErrors(testSource); |
| + expectIdentifierType('c;', 'C<Map<int, int>, int>'); |
| + } |
| + |
| + test_instantiateToBounds_ok_referenceOther_before() async { |
| + String code = r''' |
| +class C<T0 extends int, T1 extends T0> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code); |
| + assertNoErrors(testSource); |
| + expectIdentifierType('c;', 'C<int, int>'); |
| + } |
| + |
| + test_instantiateToBounds_ok_referenceOther_multi() async { |
| + String code = r''' |
| +class C<T0 extends Map<T1, T2>, T1 extends List<T2>, T2 extends int> {} |
| +C c; |
| +'''; |
| + await resolveTestUnit(code); |
| + assertNoErrors(testSource); |
| + expectIdentifierType('c;', 'C<Map<List<int>, int>, List<int>, int>'); |
| + } |
| + |
| + test_instantiateToBounds_ok_simpleBounds() async { |
| + String code = r''' |
| +class A<T> {} |
| +class B<T extends num> {} |
| +class C<T extends List<int>> {} |
| + |
| +void main() { |
| + A a; |
| + B b; |
| + C c; |
| +} |
| +'''; |
| + await resolveTestUnit(code); |
| + assertNoErrors(testSource); |
| + expectIdentifierType('a;', 'A<dynamic>'); |
| + expectIdentifierType('b;', 'B<num>'); |
| + expectIdentifierType('c;', 'C<List<int>>'); |
| + } |
| + |
| test_notInstantiatedBound_direct() async { |
| String code = r''' |
| class A<T> {} |