Index: tests/language/initializing_formal_scope_test.dart |
diff --git a/tests/language/initializing_formal_capture_test.dart b/tests/language/initializing_formal_scope_test.dart |
similarity index 54% |
copy from tests/language/initializing_formal_capture_test.dart |
copy to tests/language/initializing_formal_scope_test.dart |
index 7ad3f083cc185754bd31b937bbfba57421445846..dd85fada3582b3f8f946eb73ee5084768871d976 100644 |
--- a/tests/language/initializing_formal_capture_test.dart |
+++ b/tests/language/initializing_formal_scope_test.dart |
@@ -6,14 +6,20 @@ |
import "package:expect/expect.dart"; |
+// Duplicate definition checks for `this.x` will check the scopes associated |
+// with the constructor, not all enclosing scopes; so this is not a conflict. |
+var x; |
+ |
class A { |
- var x, y; |
- A(this.x) : y = (() => x); |
+ var x; |
+ A(this.x) { |
+ // In the body the field is in scope, not the initializing formal; |
+ // so we can use the setter. |
+ x += 1; |
+ } |
} |
main() { |
A a = new A(2); |
- a.x = 3; |
Expect.equals(a.x, 3); |
- Expect.equals(a.y(), 2); |
} |