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 cfab2061b47250297d3bdfa22b40e3c0d87a1912..5f5d0ef7dd2f38381eb61562cb2e7c8434877b40 100644 |
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart |
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart |
@@ -6,7 +6,9 @@ library analyzer.test.generated.static_type_warning_code_test; |
import 'package:analyzer/src/generated/engine.dart'; |
import 'package:analyzer/src/generated/error.dart'; |
+import 'package:analyzer/src/generated/java_core.dart' show formatList; |
import 'package:analyzer/src/generated/source_io.dart'; |
+import 'package:unittest/unittest.dart'; |
import '../reflective_tests.dart'; |
import '../utils.dart'; |
@@ -15,6 +17,7 @@ import 'resolver_test.dart'; |
main() { |
initializeTestEnvironment(); |
runReflectiveTests(StaticTypeWarningCodeTest); |
+ runReflectiveTests(StrongModeStaticTypeWarningCodeTest); |
} |
@reflectiveTest |
@@ -2153,3 +2156,33 @@ Stream<int> f() sync* { |
verify([source]); |
} |
} |
+ |
+@reflectiveTest |
+class StrongModeStaticTypeWarningCodeTest extends ResolverTestCase { |
+ void setUp() { |
+ super.setUp(); |
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
+ options.strongMode = true; |
+ resetWithOptions(options); |
+ } |
+ |
+ void test_genericMethodWrongNumberOfTypeArguments() { |
+ Source source = addSource(''' |
+f() {} |
+main() { |
+ f/*<int>*/(); |
+} |
+'''); |
+ computeLibrarySourceErrors(source); |
+ assertErrors( |
+ source, [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]); |
+ for (AnalysisError error in analysisContext2.computeErrors(source)) { |
+ if (error.errorCode == |
+ StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS) { |
+ expect(error.message, |
+ formatList(error.errorCode.message, ['() → dynamic', 0, 1])); |
+ } |
+ } |
+ verify([source]); |
+ } |
+} |