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

Unified Diff: pkg/analyzer/test/generated/non_error_resolver_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
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 9974fc69836bc2737c9ea49a9c117d9c2bd151d8..7899ab738b2c6f92c7a4c4db6a6c462d5f486018 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -271,6 +271,28 @@ main() {
verify([source]);
}
+ void test_assignment_to_field_with_same_name_as_prefix() {
+ // If p is an import prefix, then within a method body, p = expr should be
+ // considered equivalent to this.p = expr.
+ addNamedSource("/lib.dart", r'''
+library lib;
+''');
+ Source source = addSource(r'''
+import 'lib.dart' as p;
+class Base {
+ var p;
+}
+class Derived extends Base {
+ f() {
+ p = 0;
+ }
+}
+''');
+ resolve(source);
+ assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ verify([source]);
+ }
+
void test_assignmentToFinal_prefixNegate() {
Source source = addSource(r'''
f() {
@@ -5157,6 +5179,28 @@ class B extends A {
verify([source]);
}
+ void test_unqualified_invocation_of_method_with_same_name_as_prefix() {
+ // If p is an import prefix, then within a method body, p() should be
+ // considered equivalent to this.p().
+ addNamedSource("/lib.dart", r'''
+library lib;
+''');
+ Source source = addSource(r'''
+import 'lib.dart' as p;
+class Base {
+ p() {}
+}
+class Derived extends Base {
+ f() {
+ p();
+ }
+}
+''');
+ resolve(source);
+ assertErrors(source, [HintCode.UNUSED_IMPORT]);
+ verify([source]);
+ }
+
void test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new() {
Source source = addSource(r'''
class A {

Powered by Google App Engine
This is Rietveld 408576698