| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.test.generated.strong_mode_test; | 5 library analyzer.test.generated.strong_mode_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1952 '''; | 1952 '''; |
| 1953 await resolveTestUnit(code, noErrors: false); | 1953 await resolveTestUnit(code, noErrors: false); |
| 1954 expectIdentifierType('ai', "A<dynamic>"); | 1954 expectIdentifierType('ai', "A<dynamic>"); |
| 1955 expectIdentifierType('bi', "B<num>"); | 1955 expectIdentifierType('bi', "B<num>"); |
| 1956 expectIdentifierType('ci', "C<int, B<int>, B<dynamic>>"); | 1956 expectIdentifierType('ci', "C<int, B<int>, B<dynamic>>"); |
| 1957 expectIdentifierType('aa', "A<dynamic>"); | 1957 expectIdentifierType('aa', "A<dynamic>"); |
| 1958 expectIdentifierType('bb', "B<num>"); | 1958 expectIdentifierType('bb', "B<num>"); |
| 1959 expectIdentifierType('cc', "C<int, B<int>, B<dynamic>>"); | 1959 expectIdentifierType('cc', "C<int, B<int>, B<dynamic>>"); |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 test_notInstantiatedBound_direct() async { |
| 1963 String code = r''' |
| 1964 class A<T> {} |
| 1965 class C<T extends A> {} |
| 1966 '''; |
| 1967 await resolveTestUnit(code, noErrors: false); |
| 1968 assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]); |
| 1969 } |
| 1970 |
| 1971 test_notInstantiatedBound_indirect() async { |
| 1972 String code = r''' |
| 1973 class A<T> {} |
| 1974 class B<T> {} |
| 1975 class C<T extends A<B>> {} |
| 1976 '''; |
| 1977 await resolveTestUnit(code, noErrors: false); |
| 1978 assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]); |
| 1979 } |
| 1980 |
| 1981 test_notInstantiatedBound_indirect2() async { |
| 1982 String code = r''' |
| 1983 class A<K, V> {} |
| 1984 class B<T> {} |
| 1985 class C<T extends A<B, B>> {} |
| 1986 '''; |
| 1987 await resolveTestUnit(code, noErrors: false); |
| 1988 assertErrors(testSource, [ |
| 1989 StrongModeCode.NOT_INSTANTIATED_BOUND, |
| 1990 StrongModeCode.NOT_INSTANTIATED_BOUND |
| 1991 ]); |
| 1992 } |
| 1993 |
| 1962 test_objectMethodOnFunctions_Anonymous() async { | 1994 test_objectMethodOnFunctions_Anonymous() async { |
| 1963 String code = r''' | 1995 String code = r''' |
| 1964 void main() { | 1996 void main() { |
| 1965 var f = (x) => 3; | 1997 var f = (x) => 3; |
| 1966 // No errors, correct type | 1998 // No errors, correct type |
| 1967 var t0 = f.toString(); | 1999 var t0 = f.toString(); |
| 1968 var t1 = f.toString; | 2000 var t1 = f.toString; |
| 1969 var t2 = f.hashCode; | 2001 var t2 = f.hashCode; |
| 1970 | 2002 |
| 1971 // Expressions, no errors, correct type | 2003 // Expressions, no errors, correct type |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 main() { | 2444 main() { |
| 2413 var v = x; | 2445 var v = x; |
| 2414 v; // marker | 2446 v; // marker |
| 2415 } | 2447 } |
| 2416 int x = 3; | 2448 int x = 3; |
| 2417 '''; | 2449 '''; |
| 2418 await assertPropagatedAssignedType(code, typeProvider.intType, null); | 2450 await assertPropagatedAssignedType(code, typeProvider.intType, null); |
| 2419 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); | 2451 await assertTypeOfMarkedExpression(code, typeProvider.intType, null); |
| 2420 } | 2452 } |
| 2421 } | 2453 } |
| OLD | NEW |