Chromium Code Reviews| Index: tests/language/src/ConstructorDuplicateInitializersTest.dart |
| diff --git a/tests/language/src/ConstructorDuplicateInitializersTest.dart b/tests/language/src/ConstructorDuplicateInitializersTest.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..539158744818ea0edf105b5c7f1625915efc082b |
| --- /dev/null |
| +++ b/tests/language/src/ConstructorDuplicateInitializersTest.dart |
| @@ -0,0 +1,21 @@ |
| +// 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. |
| +// Check that initializers are not duplicated |
| + |
| + |
| +class Class { |
| + Class(var v) |
| + : field_ = v |
| + , field_ = 2 /// 01: compile-time error |
|
ahe
2012/01/03 22:57:12
I suggest adding a comment above explaining what t
codefu
2012/01/04 15:18:49
Done.
|
| + ; |
| + Class.field(this.field_) |
| + : field_ = 2 /// 02: compile-time error |
|
ahe
2012/01/03 22:57:12
Ditto.
codefu
2012/01/04 15:18:49
Done.
|
| + ; |
| + final field_; |
| +} |
| + |
| +main() { |
| + new Class(42); |
| + new Class.field(42); |
| +} |