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

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

Issue 1173523002: Fix analyzer's handling of import prefixes not followed by '.'. (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
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 abea165f789d5dede42bcc438a13f4188918165c..4994f395b403c75036481505f9b89703df30bee5 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -4,6 +4,7 @@
library engine.compile_time_error_code_test;
+import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
import 'package:analyzer/src/generated/source_io.dart';
@@ -4566,6 +4567,26 @@ part 'l2.dart';''');
verify([source]);
}
+ void test_prefix_conditionalPropertyAccess_call() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+g() {}
+''');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p?.g();
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() {
addNamedSource("/lib.dart", r'''
library lib;
@@ -4622,6 +4643,54 @@ p.A a;''');
verify([source]);
}
+ void test_prefixNotFollowedByDot() {
+ addNamedSource('/lib.dart', 'library lib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ return p;
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefixNotFollowedByDot_compoundAssignment() {
+ addNamedSource('/lib.dart', 'library lib;');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p += 1;
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefixNotFollowedByDot_conditionalMethodInvocation() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+g() {}
+''');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p?.g();
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
void test_privateOptionalParameter() {
Source source = addSource("f({var _p}) {}");
resolve(source);
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.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