dart-sdk/tests/language/prefix/unqualified_invocation_test.dart
Robert Nystrom 578fa6bee9 Migrate language_2/prefix to NNBD.
Change-Id: I5149b18d796c6991404c22322e5fb4b4c8372613
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150287
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-06-06 01:44:40 +00:00

36 lines
1 KiB
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();
// ^
// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
// [cfe] A prefix can't be used as an expression.
}
}
main() {
new Derived().f();
p();
//^
// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
// [cfe] A prefix can't be used as an expression.
}