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

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

Issue 1882633002: Clean up reporting HintCode.UNUSED_SHOWN_NAME when a prefixed top-level function is invoked. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Added new test. Created 4 years, 8 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 "/lib1.dart", 1089 "/lib1.dart",
1090 r''' 1090 r'''
1091 library lib1; 1091 library lib1;
1092 class One {} 1092 class One {}
1093 topLevelFunction() {}'''); 1093 topLevelFunction() {}''');
1094 computeLibrarySourceErrors(source); 1094 computeLibrarySourceErrors(source);
1095 assertNoErrors(source); 1095 assertNoErrors(source);
1096 verify([source]); 1096 verify([source]);
1097 } 1097 }
1098 1098
1099 void test_unusedImport_prefix_topLevelFunction2() {
1100 Source source = addSource(r'''
1101 library L;
1102 import 'lib1.dart' hide topLevelFunction;
1103 import 'lib1.dart' as one show topLevelFunction;
1104 import 'lib1.dart' as two show topLevelFunction;
1105 class A {
1106 static void x() {
1107 One o;
1108 one.topLevelFunction();
1109 two.topLevelFunction();
1110 }
1111 }''');
1112 addNamedSource(
1113 "/lib1.dart",
1114 r'''
1115 library lib1;
1116 class One {}
1117 topLevelFunction() {}''');
1118 computeLibrarySourceErrors(source);
1119 assertNoErrors(source);
1120 verify([source]);
1121 }
1122
1099 void test_useOfVoidResult_implicitReturnValue() { 1123 void test_useOfVoidResult_implicitReturnValue() {
1100 Source source = addSource(r''' 1124 Source source = addSource(r'''
1101 f() {} 1125 f() {}
1102 class A { 1126 class A {
1103 n() { 1127 n() {
1104 var a = f(); 1128 var a = f();
1105 } 1129 }
1106 }'''); 1130 }''');
1107 computeLibrarySourceErrors(source); 1131 computeLibrarySourceErrors(source);
1108 assertNoErrors(source); 1132 assertNoErrors(source);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 1226
1203 void test_import_valid_outside_lib() { 1227 void test_import_valid_outside_lib() {
1204 cacheSource("/myproj/pubspec.yaml", ""); 1228 cacheSource("/myproj/pubspec.yaml", "");
1205 cacheSource("/myproj/web/other.dart", ""); 1229 cacheSource("/myproj/web/other.dart", "");
1206 Source source = 1230 Source source =
1207 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); 1231 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
1208 computeLibrarySourceErrors(source); 1232 computeLibrarySourceErrors(source);
1209 assertNoErrors(source); 1233 assertNoErrors(source);
1210 } 1234 }
1211 } 1235 }
OLDNEW
« no previous file with comments | « 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