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

Unified Diff: tests/language/prefix_unqualified_invocation_test.dart

Issue 1186033004: Update analyzer to reflect new rules for prefixes. (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 | « tests/language/prefix_assignment_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/prefix_unqualified_invocation_test.dart
diff --git a/tests/language/prefix_unqualified_invocation_test.dart b/tests/language/prefix_unqualified_invocation_test.dart
index 29eebb94d96f12ff9470c631c0e2c3221aaa2af3..020ca3e53190ea0a3c2a2b2e7e279d90b6e09f1b 100644
--- a/tests/language/prefix_unqualified_invocation_test.dart
+++ b/tests/language/prefix_unqualified_invocation_test.dart
@@ -2,44 +2,28 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// Validate that an attempt to invoke a prefix is handled consistently with the
-// following spec text from section 16.14.3 (Unqualified invocation):
+// Validate the following spec text from section 16.14.3 (Unqualified
+// invocation):
// An unqualifiedfunction invocation i has the form
// id(a1, ..., an, xn+1 : an+1, ..., xn+k : an+k),
// where id is an identifier.
// If there exists a lexically visible declaration named id, let fid be the
-// innermost such declaration. Then
-// - If fid isa local function, a library function, a library or static
-// getter or a variable then ...
-// - Otherwise, if fid is a static method of the enclosing class C, ...
-// - Otherwise, fid is considered equivalent to the ordinary method
-// invocation this.id(a1, ..., an, xn+1 : an+1, ..., xn+k : an+k).
-//
-// Therefore, if p is an import prefix, evaluation of "p()" should be
-// equivalent to "this.p()". That is, it should call the method "p"
-// dynamically if inside a method, and should produce a NoSucMethodError (and a
-// static warning) outside a method.
+// innermost such declaration. Then:
+// - If fid is a prefix object, a compile-time error occurs.
-import "package:expect/expect.dart";
import "empty_library.dart" as p;
class Base {
- var pCalled = false;
-
- void p() {
- pCalled = true;
- }
+ void p() {}
}
class Derived extends Base {
void f() {
- p(); Expect.isTrue(pCalled); /// 01: ok
+ p(); /// 01: compile-time error
}
}
-noMethod(e) => e is NoSuchMethodError;
-
main() {
new Derived().f();
- Expect.throws(() { p(); }, noMethod); /// 02: static type warning
+ p(); /// 02: compile-time error
}
« no previous file with comments | « tests/language/prefix_assignment_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698