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

Unified Diff: tests/language/bad_constructor_test.dart

Issue 10905109: Add named constructor name checking (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: tests/language/bad_constructor_test.dart
===================================================================
--- tests/language/bad_constructor_test.dart (revision 11907)
+++ tests/language/bad_constructor_test.dart (working copy)
@@ -1,8 +1,8 @@
// Copyright (c) 2012, 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.
+// VMOptions=--constructor_name_check
ahe 2012/09/06 08:54:26 Please don't add VM specific options to shared lan
Ivan Posva 2012/09/06 09:12:50 Would you rather have us break all of the users by
ahe 2012/09/06 09:32:59 That's a strange trade-off. You can have a VM-spec
Ivan Posva 2012/09/06 10:39:01 I think it makes perfect sense to have the tests t
hausner 2012/09/06 16:18:38 Yes, this flag goes away as soon as we enable the
-
class A {
// Constructor may not be static.
static A(); /// 00: compile-time error
@@ -15,6 +15,16 @@
// Factory may not be abstract
abstract factory A() { return null; } /// 03: compile-time error
+
+ // Named constructor may not conflict with names of methods and fields.
+ var m;
+ A.m() { m = 0; } /// 04: compile-time error
+
+ set q(var value) { m = q; }
+ A.q(); /// 05: compile-time error
+
+ int foo(int a, int b) => a + b * m;
+ A.foo() : m = 0; /// 06: compile-time error
siva 2012/09/06 16:52:10 We should add a test where the named constructor a
hausner 2012/09/06 18:02:13 Done.
}
main() {

Powered by Google App Engine
This is Rietveld 408576698