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

Unified Diff: test/checker/checker_test.dart

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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: test/checker/checker_test.dart
diff --git a/test/checker/checker_test.dart b/test/checker/checker_test.dart
index abf647235613336ee6b2c718119726dcec8810bf..0a8bbb8c69a7cf77e9e3eb525d16cd0fd519404a 100644
--- a/test/checker/checker_test.dart
+++ b/test/checker/checker_test.dart
@@ -130,6 +130,36 @@ main() {
});
});
+ test('Constructors', () {
+ testChecker({
+ '/main.dart': '''
+ const num z = 25;
+
+ class A {
+ int x;
+ String y;
+
+ A(this.x) : this.y = /*severe:StaticTypeError*/42;
+
+ A.c1(p): this.x = /*info:DownCast*/z, this.y = /*info:DownCast*/p;
+
+ A.c2(this.x, this.y);
+ }
Leaf 2015/02/26 22:00:16 I think you can say something like: A.c3(num this
vsm 2015/02/26 23:55:47 Added - along with code to fix. :-)
+
+ class B extends A {
+ B() : super(/*severe:StaticTypeError*/"hello");
+
+ B.c2(int x, String y) : super.c2(/*severe:StaticTypeError*/y,
+ /*severe:StaticTypeError*/x);
+ }
+
+ void main() {
+ var a = new A.c2(z, z);
+ }
+ '''
+ });
+ });
+
test('Unbound variable', () {
testChecker({
'/main.dart': '''

Powered by Google App Engine
This is Rietveld 408576698