Chromium Code Reviews| Index: pkg/analyzer/test/generated/static_type_warning_code_test.dart |
| diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart |
| index 4568fe9a1c8bc2651e920e8cc2c8f5de1f8f40d9..9873f93a317e206704160b03bf68fe1f57332606 100644 |
| --- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart |
| +++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart |
| @@ -1288,6 +1288,64 @@ var b = 1 is G<B>; |
| [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| } |
| + void test_typeArgumentNotMatchingBounds_methodInvocation_localFunction() { |
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); |
| + assertErrorsInCode( |
| + r''' |
| +class Point<T extends num> { |
| + Point(T x, T y); |
| +} |
| + |
| +main() { |
| + Point/*<T>*/ f/*<T extends num>*/(num/*=T*/ x, num/*=T*/ y) { |
|
scheglov
2016/04/28 17:14:52
I'm not sure why we need to use Point in these tes
Brian Wilkerson
2016/04/28 20:46:11
I just copied the test without thinking about it t
|
| + return new Point/*<T>*/(x, y); |
| + } |
| + print(f/*<String>*/('hello', 'world')); |
| +} |
| +''', |
| + [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| + } |
| + |
| + void test_typeArgumentNotMatchingBounds_methodInvocation_method() { |
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); |
| + assertErrorsInCode( |
| + r''' |
| +class Point<T extends num> { |
| + Point(T x, T y); |
| +} |
| + |
| +class PointFactory { |
| + Point/*<T>*/ point/*<T extends num>*/(num/*=T*/ x, num/*=T*/ y) { |
| + return new Point/*<T>*/(x, y); |
| + } |
| +} |
| + |
| +f(PointFactory factory) { |
| + print(factory.point/*<String>*/('hello', 'world')); |
| +} |
| +''', |
| + [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| + } |
| + |
| + void test_typeArgumentNotMatchingBounds_methodInvocation_topLevelFunction() { |
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true); |
| + assertErrorsInCode( |
| + r''' |
| +class Point<T extends num> { |
| + Point(T x, T y); |
| +} |
| + |
| +Point/*<T>*/ f/*<T extends num>*/(num/*=T*/ x, num/*=T*/ y) { |
| + return new Point/*<T>*/(x, y); |
| +} |
| + |
| +main() { |
| + print(f/*<String>*/('hello', 'world')); |
| +} |
| +''', |
| + [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]); |
| + } |
| + |
| void test_typeArgumentNotMatchingBounds_methodReturnType() { |
| assertErrorsInCode( |
| r''' |