b8b072ed3b
This updates the message text for undefined access. Instead of saying that the member is not defined on the "class", it now says on the "type". Closes #60290 Change-Id: I9387f892e99ba109b9b1d99af25714ab83b5350c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433941 Reviewed-by: Erik Ernst <eernst@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
41 lines
1.0 KiB
Dart
41 lines
1.0 KiB
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.
|
|
|
|
// Type parameters can shadow a library prefix.
|
|
|
|
import "package:expect/expect.dart";
|
|
import "../library10.dart" as T;
|
|
import "../library10.dart" as lib10;
|
|
|
|
class P<T> {
|
|
test() {
|
|
new T.Library10(10);
|
|
// ^
|
|
// [analyzer] COMPILE_TIME_ERROR.PREFIX_SHADOWED_BY_LOCAL_DECLARATION
|
|
// ^
|
|
// [cfe] Couldn't find constructor 'T.Library10'.
|
|
}
|
|
}
|
|
|
|
main() {
|
|
new P<int>().test();
|
|
|
|
{
|
|
// Variables in the local scope hide the library prefix.
|
|
var lib10 = 0;
|
|
var result = 0;
|
|
result = lib10.Library10.static_fld;
|
|
// ^^^^^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_GETTER
|
|
// [cfe] The getter 'Library10' isn't defined for the type 'int'.
|
|
Expect.equals(4, result);
|
|
}
|
|
|
|
{
|
|
// Shadowing is not an error.
|
|
var lib10 = 1;
|
|
Expect.equals(2, lib10 + 1);
|
|
}
|
|
}
|