@@ -6,7 +6,9 @@ library analyzer.test.generated.static_type_warning_code_test;
6
6
7
7
import 'package:analyzer/src/generated/engine.dart' ;
8
8
import 'package:analyzer/src/generated/error.dart' ;
9
+ import 'package:analyzer/src/generated/java_core.dart' show formatList;
9
10
import 'package:analyzer/src/generated/source_io.dart' ;
11
+ import 'package:unittest/unittest.dart' ;
10
12
11
13
import '../reflective_tests.dart' ;
12
14
import '../utils.dart' ;
@@ -15,6 +17,7 @@ import 'resolver_test.dart';
15
17
main () {
16
18
initializeTestEnvironment ();
17
19
runReflectiveTests (StaticTypeWarningCodeTest );
20
+ runReflectiveTests (StrongModeStaticTypeWarningCodeTest );
18
21
}
19
22
20
23
@reflectiveTest
@@ -2153,3 +2156,33 @@ Stream<int> f() sync* {
2153
2156
verify ([source]);
2154
2157
}
2155
2158
}
2159
+
2160
+ @reflectiveTest
2161
+ class StrongModeStaticTypeWarningCodeTest extends ResolverTestCase {
2162
+ void setUp () {
2163
+ super .setUp ();
2164
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl ();
2165
+ options.strongMode = true ;
2166
+ resetWithOptions (options);
2167
+ }
2168
+
2169
+ void test_genericMethodWrongNumberOfTypeArguments () {
2170
+ Source source = addSource ('''
2171
+ f() {}
2172
+ main() {
2173
+ f/*<int>*/();
2174
+ }
2175
+ ''' );
2176
+ computeLibrarySourceErrors (source);
2177
+ assertErrors (
2178
+ source, [StaticTypeWarningCode .WRONG_NUMBER_OF_TYPE_ARGUMENTS ]);
2179
+ for (AnalysisError error in analysisContext2.computeErrors (source)) {
2180
+ if (error.errorCode ==
2181
+ StaticTypeWarningCode .WRONG_NUMBER_OF_TYPE_ARGUMENTS ) {
2182
+ expect (error.message,
2183
+ formatList (error.errorCode.message, ['() → dynamic' , 0 , 1 ]));
2184
+ }
2185
+ }
2186
+ verify ([source]);
2187
+ }
2188
+ }
0 commit comments