Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: pkg/analyzer/test/generated/non_hint_code_test.dart

Issue 1797593003: Stop reporting use of deprecated members from within deprecated members (issue 25966) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.non_hint_code_test; 5 library analyzer.test.generated.non_hint_code_test;
6 6
7 import 'package:analyzer/src/generated/error.dart'; 7 import 'package:analyzer/src/generated/error.dart';
8 import 'package:analyzer/src/generated/source_io.dart'; 8 import 'package:analyzer/src/generated/source_io.dart';
9 9
10 import '../reflective_tests.dart'; 10 import '../reflective_tests.dart';
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 Source source = addSource(r''' 151 Source source = addSource(r'''
152 const bool DEBUG = true; 152 const bool DEBUG = true;
153 f() { 153 f() {
154 bool b = DEBUG || true; 154 bool b = DEBUG || true;
155 }'''); 155 }''');
156 computeLibrarySourceErrors(source); 156 computeLibrarySourceErrors(source);
157 assertNoErrors(source); 157 assertNoErrors(source);
158 verify([source]); 158 verify([source]);
159 } 159 }
160 160
161 void test_deprecatedAnnotationUse_classWithConstructor() { 161 void test_deprecatedMemberUse_inDeprecatedClass() {
162 Source source = addSource(r''' 162 Source source = addSource(r'''
163 @deprecated 163 @deprecated
164 f() {}
165
166 @deprecated
164 class C { 167 class C {
165 C(); 168 m() {
169 f();
170 }
166 } 171 }
167 '''); 172 ''');
168 computeLibrarySourceErrors(source); 173 computeLibrarySourceErrors(source);
174 assertNoErrors(source);
175 verify([source]);
176 }
177
178 void test_deprecatedMemberUse_inDeprecatedFunction() {
179 Source source = addSource(r'''
180 @deprecated
181 f() {}
182
183 @deprecated
184 g() {
185 f();
186 }
187 ''');
188 computeLibrarySourceErrors(source);
189 assertNoErrors(source);
190 verify([source]);
191 }
192
193 void test_deprecatedMemberUse_inDeprecatedMethod() {
194 Source source = addSource(r'''
195 @deprecated
196 f() {}
197
198 class C {
199 @deprecated
200 m() {
201 f();
202 }
203 }
204 ''');
205 computeLibrarySourceErrors(source);
206 assertNoErrors(source);
207 verify([source]);
208 }
209
210 void test_deprecatedMemberUse_inDeprecatedMethod_inDeprecatedClass() {
211 Source source = addSource(r'''
212 @deprecated
213 f() {}
214
215 @deprecated
216 class C {
217 @deprecated
218 m() {
219 f();
220 }
221 }
222 ''');
223 computeLibrarySourceErrors(source);
169 assertNoErrors(source); 224 assertNoErrors(source);
170 verify([source]); 225 verify([source]);
171 } 226 }
172 227
173 void test_divisionOptimization() { 228 void test_divisionOptimization() {
174 Source source = addSource(r''' 229 Source source = addSource(r'''
175 f(int x, int y) { 230 f(int x, int y) {
176 var v = x / y.toInt(); 231 var v = x / y.toInt();
177 }'''); 232 }''');
178 computeLibrarySourceErrors(source); 233 computeLibrarySourceErrors(source);
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 assertErrors(source, [ 1143 assertErrors(source, [
1089 CompileTimeErrorCode.URI_DOES_NOT_EXIST, 1144 CompileTimeErrorCode.URI_DOES_NOT_EXIST,
1090 HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT 1145 HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
1091 ]); 1146 ]);
1092 } 1147 }
1093 1148
1094 void test_import_referenceIntoLibDirectory() { 1149 void test_import_referenceIntoLibDirectory() {
1095 cacheSource("/myproj/pubspec.yaml", ""); 1150 cacheSource("/myproj/pubspec.yaml", "");
1096 cacheSource("/myproj/lib/other.dart", ""); 1151 cacheSource("/myproj/lib/other.dart", "");
1097 Source source = 1152 Source source =
1098 addNamedSource("/myproj/web/test.dart", "import '../lib/other.dart';"); 1153 addNamedSource("/myproj/web/test.dart", "import '../lib/other.dart';");
1099 computeLibrarySourceErrors(source); 1154 computeLibrarySourceErrors(source);
1100 assertErrors( 1155 assertErrors(
1101 source, [HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE]); 1156 source, [HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE]);
1102 } 1157 }
1103 1158
1104 void test_import_referenceIntoLibDirectory_no_pubspec() { 1159 void test_import_referenceIntoLibDirectory_no_pubspec() {
1105 cacheSource("/myproj/lib/other.dart", ""); 1160 cacheSource("/myproj/lib/other.dart", "");
1106 Source source = 1161 Source source =
1107 addNamedSource("/myproj/web/test.dart", "import '../lib/other.dart';"); 1162 addNamedSource("/myproj/web/test.dart", "import '../lib/other.dart';");
1108 computeLibrarySourceErrors(source); 1163 computeLibrarySourceErrors(source);
1109 assertNoErrors(source); 1164 assertNoErrors(source);
1110 } 1165 }
1111 1166
1112 void test_import_referenceOutOfLibDirectory() { 1167 void test_import_referenceOutOfLibDirectory() {
1113 cacheSource("/myproj/pubspec.yaml", ""); 1168 cacheSource("/myproj/pubspec.yaml", "");
1114 cacheSource("/myproj/web/other.dart", ""); 1169 cacheSource("/myproj/web/other.dart", "");
1115 Source source = 1170 Source source =
1116 addNamedSource("/myproj/lib/test.dart", "import '../web/other.dart';"); 1171 addNamedSource("/myproj/lib/test.dart", "import '../web/other.dart';");
1117 computeLibrarySourceErrors(source); 1172 computeLibrarySourceErrors(source);
1118 assertErrors( 1173 assertErrors(
1119 source, [HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE]); 1174 source, [HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE]);
1120 } 1175 }
1121 1176
1122 void test_import_referenceOutOfLibDirectory_no_pubspec() { 1177 void test_import_referenceOutOfLibDirectory_no_pubspec() {
1123 cacheSource("/myproj/web/other.dart", ""); 1178 cacheSource("/myproj/web/other.dart", "");
1124 Source source = 1179 Source source =
1125 addNamedSource("/myproj/lib/test.dart", "import '../web/other.dart';"); 1180 addNamedSource("/myproj/lib/test.dart", "import '../web/other.dart';");
1126 computeLibrarySourceErrors(source); 1181 computeLibrarySourceErrors(source);
1127 assertNoErrors(source); 1182 assertNoErrors(source);
1128 } 1183 }
1129 1184
1130 void test_import_valid_inside_lib1() { 1185 void test_import_valid_inside_lib1() {
1131 cacheSource("/myproj/pubspec.yaml", ""); 1186 cacheSource("/myproj/pubspec.yaml", "");
1132 cacheSource("/myproj/lib/other.dart", ""); 1187 cacheSource("/myproj/lib/other.dart", "");
1133 Source source = 1188 Source source =
1134 addNamedSource("/myproj/lib/test.dart", "import 'other.dart';"); 1189 addNamedSource("/myproj/lib/test.dart", "import 'other.dart';");
1135 computeLibrarySourceErrors(source); 1190 computeLibrarySourceErrors(source);
1136 assertNoErrors(source); 1191 assertNoErrors(source);
1137 } 1192 }
1138 1193
1139 void test_import_valid_inside_lib2() { 1194 void test_import_valid_inside_lib2() {
1140 cacheSource("/myproj/pubspec.yaml", ""); 1195 cacheSource("/myproj/pubspec.yaml", "");
1141 cacheSource("/myproj/lib/bar/other.dart", ""); 1196 cacheSource("/myproj/lib/bar/other.dart", "");
1142 Source source = addNamedSource( 1197 Source source = addNamedSource(
1143 "/myproj/lib/foo/test.dart", "import '../bar/other.dart';"); 1198 "/myproj/lib/foo/test.dart", "import '../bar/other.dart';");
1144 computeLibrarySourceErrors(source); 1199 computeLibrarySourceErrors(source);
1145 assertNoErrors(source); 1200 assertNoErrors(source);
1146 } 1201 }
1147 1202
1148 void test_import_valid_outside_lib() { 1203 void test_import_valid_outside_lib() {
1149 cacheSource("/myproj/pubspec.yaml", ""); 1204 cacheSource("/myproj/pubspec.yaml", "");
1150 cacheSource("/myproj/web/other.dart", ""); 1205 cacheSource("/myproj/web/other.dart", "");
1151 Source source = 1206 Source source =
1152 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); 1207 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
1153 computeLibrarySourceErrors(source); 1208 computeLibrarySourceErrors(source);
1154 assertNoErrors(source); 1209 assertNoErrors(source);
1155 } 1210 }
1156 } 1211 }
OLDNEW
« pkg/analyzer/lib/src/generated/resolver.dart ('K') | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698