| Index: pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart
|
| diff --git a/pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart b/pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6f538dcae3d064bc114b2f293d2d545ab903007e
|
| --- /dev/null
|
| +++ b/pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart
|
| @@ -0,0 +1,36 @@
|
| +// 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.
|
| +
|
| +import "package:expect/expect.dart";
|
| +import 'package:meta/meta.dart' show checked;
|
| +
|
| +// Test runtime behavior of @checked
|
| +
|
| +class View {
|
| + addChild(View v) {}
|
| + transform(View fn(View v)) {}
|
| +}
|
| +class MyView extends View {
|
| + addChild(@checked MyView v) {}
|
| + transform(@checked MyView fn(Object v)) {}
|
| +}
|
| +
|
| +main() {
|
| + dynamic mv = new MyView();
|
| + dynamic v = new View();
|
| +
|
| + mv.addChild(mv);
|
| + Expect.throws(() => mv.addChild(v));
|
| +
|
| + mv.transform((_) => new MyView());
|
| +
|
| + // TODO(jmesserly): these *should* be a cast failures, but DDC is currently
|
| + // ignoring function type failures w/ a warning at the console...
|
| +
|
| + // * -> * not a subtype of Object -> MyView
|
| + // Expect.throws(() => mv.transform((_) => mv));
|
| +
|
| + // View -> View not a subtype of Object -> MyView
|
| + // Expect.throws(() => mv.transform((View x) => x));
|
| +}
|
|
|