| Index: test/codegen/covariance.dart
|
| diff --git a/test/codegen/covariance.dart b/test/codegen/covariance.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..89c27615a523fedc6f4e536c89e221892b84b070
|
| --- /dev/null
|
| +++ b/test/codegen/covariance.dart
|
| @@ -0,0 +1,27 @@
|
| +// Copyright (c) 2015, 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.
|
| +
|
| +class Foo<T> {
|
| + T _t;
|
| + add(T t) {
|
| + _t = t;
|
| + }
|
| +
|
| + forEach(void fn(T t)) {
|
| + // No check needed for `fn`
|
| + fn(_t);
|
| + }
|
| +}
|
| +
|
| +class Bar extends Foo<int> {
|
| + add(int x) {
|
| + print('Bar.add got $x');
|
| + super.add(x);
|
| + }
|
| +}
|
| +
|
| +main() {
|
| + Foo<Object> foo = new Bar();
|
| + foo.add('hi'); // should throw
|
| +}
|
|
|