Index: pkg/dev_compiler/test/codegen/language/initializing_formal_type_test.dart |
diff --git a/pkg/dev_compiler/test/codegen/language/initializing_formal_type_test.dart b/pkg/dev_compiler/test/codegen/language/initializing_formal_type_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..af4444481f44c8070642c7f1356d29ae3bcb7b3e |
--- /dev/null |
+++ b/pkg/dev_compiler/test/codegen/language/initializing_formal_type_test.dart |
@@ -0,0 +1,25 @@ |
+// Copyright (c) 2016, 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. |
+// |
+// DartOptions=--initializing-formal-access |
+// VMOptions=--initializing-formal-access |
+ |
+import "package:expect/expect.dart"; |
+ |
+class A { |
+ num x; |
+ double y; |
+ // Finding the type of an initializing formal: should cause a warning |
+ // in the initializer but not the body, because the former has type |
+ // `int` and the latter has type `num`. |
+ A(int this.x) : y = x { |
eernst
2016/11/30 10:22:46
I would expect the above initialization to be an e
|
+ y = x; |
+ } |
+} |
+ |
+main() { |
+ A a = new A(null); |
+ Expect.equals(a.x, null); |
+ Expect.equals(a.y, null); |
+} |