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

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

Issue 1255293005: Fix analyzer interpretation of 'ClassName?.staticMember'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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/non_error_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index c77d424e657979e532d2cf9f2ea6349aed7b1e0e..c1da94108bf40ee9de8f229fe5a7250694cbc84e 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -6,7 +6,6 @@ library engine.non_error_resolver_test;
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
-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';
@@ -5002,12 +5001,14 @@ class Bar extends Foo {
verify([source]);
}
- void test_undefinedGetter_typeLiteral_conditionalAccess() {
- // When applied to a type literal, the conditional access operator '?.' can
- // be used to access instance getters of Type.
+ void test_undefinedGetter_static_conditionalAccess() {
+ // The conditional access operator '?.' can be used to access static
+ // fields.
Source source = addSource('''
-class A {}
-f() => A?.hashCode;
+class A {
+ static var x;
+}
+var a = A?.x;
''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
@@ -5089,12 +5090,14 @@ main() {
// A call to verify(source) fails as '(() => null)()' isn't resolved.
}
- void test_undefinedMethod_typeLiteral_conditionalAccess() {
- // When applied to a type literal, the conditional access operator '?.' can
- // be used to access instance methods of Type.
+ void test_undefinedMethod_static_conditionalAccess() {
+ // The conditional access operator '?.' can be used to access static
+ // methods.
Source source = addSource('''
-class A {}
-f() => A?.toString();
+class A {
+ static void m() {}
+}
+f() { A?.m(); }
''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
@@ -5139,6 +5142,20 @@ main() {
verify([source]);
}
+ void test_undefinedSetter_static_conditionalAccess() {
+ // The conditional access operator '?.' can be used to access static
+ // fields.
+ Source source = addSource('''
+class A {
+ static var x;
+}
+f() { A?.x = 1; }
+''');
+ computeLibrarySourceErrors(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_undefinedSuperMethod_field() {
Source source = addSource(r'''
class A {
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/test/generated/static_type_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698