dart-sdk/tests/language_2/variable_shadow_class_test.dart
Bob Nystrom bed71b7776 Migrate and clean up the prefix negative tests.
Since there were already non-negative tests with the same numbers, I
gave them meaningful names.

Merged a couple of tests into the same file when it made sense since
multitests let us do that.

Deleted prefix1_negative_test, because it essentially tested only that
a random identifier does not resolve, which is not particularly related
to prefixes.

Change-Id: I91718f6df5126f123d9a8ea3abbc6898797db2db
Reviewed-on: https://dart-review.googlesource.com/52985
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-02 16:05:25 +00:00

27 lines
611 B
Dart

// Copyright (c) 2011, 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.
import "package:expect/expect.dart";
// Local variables can shadow class names.
class Test {
final int field;
Test.named(this.field);
}
main() {
{
var Test; //# 01: compile-time error
// Now this refers to the variable.
var i = new Test.named(10);
Expect.equals(10, i.field);
}
{
// Shadowing is allowed.
var Test = 1;
Expect.equals(2, Test + 1);
}
}