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

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

Issue 1177833002: Ensure that prefix?.loadLibrary() generates the proper compile-time error. (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/element_resolver.dart ('k') | no next file » | 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 58871cc982fda84b18df411bb0c095af885a910d..540f98365714ddd1f633298167da0c1ad464e0d1 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -4723,6 +4723,103 @@ f() {
verify([source]);
}
+ void test_prefix_conditionalPropertyAccess_call_loadLibrary() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+''');
+ Source source = addSource('''
+import 'lib.dart' deferred as p;
+f() {
+ p?.loadLibrary();
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_conditionalPropertyAccess_get() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+var x;
+''');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ return p?.x;
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_conditionalPropertyAccess_get_loadLibrary() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+''');
+ Source source = addSource('''
+import 'lib.dart' deferred as p;
+f() {
+ return p?.loadLibrary;
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_conditionalPropertyAccess_set() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+var x;
+''');
+ Source source = addSource('''
+import 'lib.dart' as p;
+f() {
+ p?.x = null;
+}
+''');
+ resolve(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
+ verify([source]);
+ }
+
+ void test_prefix_conditionalPropertyAccess_set_loadLibrary() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ addNamedSource('/lib.dart', '''
+library lib;
+''');
+ Source source = addSource('''
+import 'lib.dart' deferred as p;
+f() {
+ p?.loadLibrary = null;
+}
+''');
+ resolve(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') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698