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

Unified Diff: pkg/analyzer/test/generated/static_type_warning_code_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/static_type_warning_code_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index a346a872116509e12f3534600ac7032135a83d58..b49a115200dd927bf29a6e3b9bd5050fb0da704a 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -1391,14 +1391,12 @@ var a = A.B;''');
assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
}
- void test_undefinedGetter_static_conditionalAccess() {
- // The conditional access operator '?.' cannot be used to access static
- // fields.
+ void test_undefinedGetter_typeLiteral_conditionalAccess() {
+ // When applied to a type literal, the conditional access operator '?.'
+ // cannot be used to access instance getters of Type.
Source source = addSource('''
-class A {
- static var x;
-}
-var a = A?.x;
+class A {}
+f() => A?.hashCode;
''');
computeLibrarySourceErrors(source);
assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
@@ -1562,14 +1560,12 @@ main() {
assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]);
}
- void test_undefinedMethod_static_conditionalAccess() {
- // The conditional access operator '?.' cannot be used to access static
- // methods.
+ void test_undefinedMethod_typeLiteral_conditionalAccess() {
+ // When applied to a type literal, the conditional access operator '?.'
+ // cannot be used to access instance methods of Type.
Source source = addSource('''
-class A {
- static void m() {}
-}
-f() { A?.m(); }
+class A {}
+f() => A?.toString();
''');
computeLibrarySourceErrors(source);
assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]);
@@ -1651,19 +1647,6 @@ f() { A.B = 0;}''');
assertErrors(source, [StaticTypeWarningCode.UNDEFINED_SETTER]);
}
- void test_undefinedSetter_static_conditionalAccess() {
- // The conditional access operator '?.' cannot be used to access static
- // fields.
- Source source = addSource('''
-class A {
- static var x;
-}
-f() { A?.x = 1; }
-''');
- computeLibrarySourceErrors(source);
- assertErrors(source, [StaticTypeWarningCode.UNDEFINED_SETTER]);
- }
-
void test_undefinedSetter_void() {
Source source = addSource(r'''
class T {
« no previous file with comments | « pkg/analyzer/test/generated/non_error_resolver_test.dart ('k') | tests/language/conditional_access_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698