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

Unified Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1186033004: Update analyzer to reflect new rules for prefixes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index cdea519d74a2d39f3dde614ac856675659726d09..cfc2f626a02c90f30962199c809c242e234c53f9 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -4705,6 +4705,66 @@ part 'test.dart';''');
verify([source]);
}
+ void test_prefix_assignment_compound_in_method() {
+ addNamedSource('/lib.dart', 'library lib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+class C {
+ f() {
+ p += 1;
+ }
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_assignment_compound_not_in_method() {
+ addNamedSource('/lib.dart', 'library lib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p += 1;
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_assignment_in_method() {
+ addNamedSource('/lib.dart', 'library lib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+class C {
+ f() {
+ p = 1;
+ }
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_assignment_not_in_method() {
+ addNamedSource('/lib.dart', 'library lib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p = 1;
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
void test_prefix_conditionalPropertyAccess_call() {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableNullAwareOperators = true;
@@ -4822,6 +4882,36 @@ f() {
verify([source]);
}
+ void test_prefix_unqualified_invocation_in_method() {
+ addNamedSource('/lib.dart', 'librarylib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+class C {
+ f() {
+ p();
+ }
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_unqualified_invocation_not_in_method() {
+ addNamedSource('/lib.dart', 'librarylib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p();
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() {
addNamedSource("/lib.dart", r'''
library lib;
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698