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

Unified Diff: sdk/lib/_internal/compiler/implementation/warnings.dart

Issue 23948006: Emit a compile-time error on members with the name of their enclosing class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: dart2dart test expectations. Created 7 years, 3 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 | « sdk/lib/_internal/compiler/implementation/elements/modelx.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/warnings.dart
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index bd06786f895183766f130b48cb048047c567f3ec..75f36f38c129567970475d49007a8482c4cb69a0 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -818,6 +818,20 @@ void main() {
const c; // This constant variable must be initialized.
}"""]);
+ static const MessageKind MEMBER_USES_CLASS_NAME = const MessageKind(
+ "Error: Member variable can't have the same name as the class it is "
+ "declared in.",
+ howToFix: "Try renaming the variable.",
+ examples: const ["""
+class A { var A; }
+main() {
+ var a = new A();
+ a.A = 1;
+}
+""", """
+class A { static var A; }
+main() => A.A = 1;
+"""]);
static const MessageKind WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT =
const MessageKind(
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/elements/modelx.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698