dart-sdk/tests/language/prefix_unqualified_invocation_test.dart
Paul Berry 9c90a66d0d Update analyzer to reflect new rules for prefixes.
As of commit 67b99e4b33, it is now
consistently a compile error for a prefix not to be followed by '.'.
(Previously, there were two exceptions in which a prefix not followed
by '.' was treated as though it was preceded by "this.")

This CL updates analyzer to be consistent with the new spec langauge,
and modifies the tests in tests/language accordingly.

Dart2js and the VM do not yet produce the correct compile-time error
in all circumstances.  See issues #23611 and #23612.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1186033004.
2015-06-18 10:03:07 -07:00

30 lines
850 B
Dart

// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// 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 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 is a prefix object, a compile-time error occurs.
import "empty_library.dart" as p;
class Base {
void p() {}
}
class Derived extends Base {
void f() {
p(); /// 01: compile-time error
}
}
main() {
new Derived().f();
p(); /// 02: compile-time error
}