| Index: tests/language/method_override_test.dart
|
| diff --git a/tests/language/method_override_test.dart b/tests/language/method_override_test.dart
|
| index ff00cef6551904c47920410f1a2611015cbf9afc..514f7fc7aa496680999576d0674488228424942d 100644
|
| --- a/tests/language/method_override_test.dart
|
| +++ b/tests/language/method_override_test.dart
|
| @@ -5,39 +5,39 @@
|
| // Checks that a method with an instantiated return type can override a method
|
| // with a generic return type.
|
|
|
| -typedef Collection<K> GetKeysFunctionType<K>();
|
| +typedef V RemoveFunctionType<K, V>(K key);
|
|
|
| class MapBase<K, V> implements Map<K, V> {
|
| - Collection<K> getKeys() {
|
| + K remove(K key) {
|
| throw 'Must be implemented';
|
| }
|
|
|
| void Tests() {
|
| Expect.isTrue(this is MapBase<int, int>);
|
|
|
| - Expect.isTrue(getKeys is GetKeysFunctionType);
|
| - Expect.isTrue(getKeys is GetKeysFunctionType<int>);
|
| - Expect.isTrue(getKeys is !GetKeysFunctionType<String>);
|
| - Expect.isTrue(getKeys is !GetKeysFunctionType<MapBase<int, int>>);
|
| + Expect.isTrue(remove is RemoveFunctionType);
|
| + Expect.isTrue(remove is RemoveFunctionType<int, int>);
|
| + Expect.isTrue(remove is !RemoveFunctionType<String, int>);
|
| + Expect.isTrue(remove is !RemoveFunctionType<MapBase<int, int>, int>);
|
| }
|
| }
|
|
|
|
|
| class MethodOverrideTest extends MapBase<String, String> {
|
| - Collection<String> getKeys() {
|
| - throw 'Is implemented';
|
| + String remove(String key) {
|
| + throw 'Must be implemented';
|
| }
|
|
|
| void Tests() {
|
| Expect.isTrue(this is MethodOverrideTest);
|
| Expect.isTrue(this is MapBase<String, String>);
|
|
|
| - Expect.isTrue(getKeys is GetKeysFunctionType);
|
| - Expect.isTrue(getKeys is GetKeysFunctionType<String>);
|
| - Expect.isTrue(getKeys is !GetKeysFunctionType<int>);
|
| - Expect.isTrue(super.getKeys is GetKeysFunctionType);
|
| - Expect.isTrue(super.getKeys is GetKeysFunctionType<String>);
|
| - Expect.isTrue(super.getKeys is !GetKeysFunctionType<int>);
|
| + Expect.isTrue(remove is RemoveFunctionType);
|
| + Expect.isTrue(remove is RemoveFunctionType<String, String>);
|
| + Expect.isTrue(remove is !RemoveFunctionType<int, int>);
|
| + Expect.isTrue(super.remove is RemoveFunctionType);
|
| + Expect.isTrue(super.remove is RemoveFunctionType<String, String>);
|
| + Expect.isTrue(super.remove is !RemoveFunctionType<int, int>);
|
| }
|
| }
|
|
|
| @@ -46,13 +46,13 @@ main() {
|
| // Since method overriding is only checked statically, explicitly check
|
| // the subtyping relation using a function type alias.
|
| var x = new MethodOverrideTest();
|
| - Expect.isTrue(x.getKeys is GetKeysFunctionType<String>);
|
| + Expect.isTrue(x.remove is RemoveFunctionType<String, String>);
|
|
|
| // Perform a few more tests.
|
| x.Tests();
|
|
|
| var m = new MapBase<int, int>();
|
| - Expect.isTrue(m.getKeys is GetKeysFunctionType<int>);
|
| + Expect.isTrue(m.remove is RemoveFunctionType<int, int>);
|
|
|
| // Perform a few more tests.
|
| m.Tests();
|
|
|