Remove uses of `retype` (#95)

* Remove uses of `retype`
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3af6a93..3c9d4dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 * Fix the parameter names in overridden methods to match the source.
 * Make tests Dart 2 type-safe.
+* Stop depending on SDK `retype` and deprecate methods.
 
 ## 1.14.9
 
diff --git a/lib/src/canonicalized_map.dart b/lib/src/canonicalized_map.dart
index b28c6cc..9e1d5cf 100644
--- a/lib/src/canonicalized_map.dart
+++ b/lib/src/canonicalized_map.dart
@@ -120,7 +120,8 @@
   void removeWhere(bool test(K key, V value)) =>
       _base.removeWhere((_, pair) => test(pair.first, pair.last));
 
-  Map<K2, V2> retype<K2, V2>() => _base.retype<K2, V2>();
+  @deprecated
+  Map<K2, V2> retype<K2, V2>() => cast<K2, V2>();
 
   V update(K key, V update(V value), {V ifAbsent()}) => _base
       .update(_canonicalize(key), (pair) => new Pair(key, update(pair.last)),
diff --git a/lib/src/empty_unmodifiable_set.dart b/lib/src/empty_unmodifiable_set.dart
index 436e88d..997619d 100644
--- a/lib/src/empty_unmodifiable_set.dart
+++ b/lib/src/empty_unmodifiable_set.dart
@@ -25,6 +25,7 @@
   bool containsAll(Iterable<Object> other) => other.isEmpty;
   Iterable<E> followedBy(Iterable<E> other) => new Set.from(other);
   E lookup(Object element) => null;
+  @deprecated
   EmptyUnmodifiableSet<T> retype<T>() => new EmptyUnmodifiableSet<T>();
   E singleWhere(bool test(E element), {E orElse()}) => super.singleWhere(test);
   Iterable<T> whereType<T>() => new EmptyUnmodifiableSet<T>();
diff --git a/lib/src/queue_list.dart b/lib/src/queue_list.dart
index 8b68cc8..8b706bf 100644
--- a/lib/src/queue_list.dart
+++ b/lib/src/queue_list.dart
@@ -98,15 +98,10 @@
     }
   }
 
-  QueueList<T> cast<T>() {
-    QueueList<Object> self = this;
-    if (self is QueueList<T>) {
-      return self;
-    }
-    return retype<T>();
-  }
+  QueueList<T> cast<T>() => QueueList._castFrom<E, T>(this);
 
-  QueueList<T> retype<T>() => QueueList._castFrom<E, T>(this);
+  @deprecated
+  QueueList<T> retype<T>() => cast<T>();
 
   String toString() => IterableBase.iterableToFullString(this, "{", "}");
 
diff --git a/lib/src/wrappers.dart b/lib/src/wrappers.dart
index cead501..f7fe578 100644
--- a/lib/src/wrappers.dart
+++ b/lib/src/wrappers.dart
@@ -61,7 +61,8 @@
 
   E reduce(E combine(E value, E element)) => _base.reduce(combine);
 
-  Iterable<T> retype<T>() => _base.retype<T>();
+  @deprecated
+  Iterable<T> retype<T>() => cast<T>();
 
   E get single => _base.single;
 
@@ -221,7 +222,8 @@
     _listBase.retainWhere(test);
   }
 
-  List<T> retype<T>() => _listBase.retype<T>();
+  @deprecated
+  List<T> retype<T>() => cast<T>();
 
   Iterable<E> get reversed => _listBase.reversed;
 
@@ -301,7 +303,8 @@
     _setBase.retainAll(elements);
   }
 
-  Set<T> retype<T>() => _setBase.retype<T>();
+  @deprecated
+  Set<T> retype<T>() => cast<T>();
 
   void retainWhere(bool test(E element)) {
     _setBase.retainWhere(test);
@@ -368,7 +371,8 @@
     _baseQueue.retainWhere(test);
   }
 
-  Queue<T> retype<T>() => _baseQueue.retype<T>();
+  @deprecated
+  Queue<T> retype<T>() => cast<T>();
 
   E removeFirst() => _baseQueue.removeFirst();
 
@@ -446,7 +450,8 @@
 
   void removeWhere(bool test(K key, V value)) => _base.removeWhere(test);
 
-  Map<K2, V2> retype<K2, V2>() => _base.retype<K2, V2>();
+  @deprecated
+  Map<K2, V2> retype<K2, V2>() => cast<K2, V2>();
 
   Iterable<V> get values => _base.values;
 
@@ -518,6 +523,7 @@
   E lookup(Object element) =>
       throw new UnsupportedError("MapKeySet doesn't support lookup().");
 
+  @deprecated
   Set<T> retype<T>() => Set.castFrom<E, T>(this);
 
   /// Returns a new set which contains all the elements of [this] and [other].
@@ -669,6 +675,7 @@
   void retainWhere(bool test(V element)) =>
       removeWhere((element) => !test(element));
 
+  @deprecated
   Set<T> retype<T>() => Set.castFrom<V, T>(this);
 
   /// Returns a new set which contains all the elements of [this] and [other].
diff --git a/pubspec.yaml b/pubspec.yaml
index 06f183e..323f039 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,12 +1,12 @@
 name: collection
-version: 1.14.10-dev
+version: 1.14.10
 author: Dart Team <misc@dartlang.org>
 description: Collections and utilities functions and classes related to collections.
 homepage: https://www.github.com/dart-lang/collection
 
 environment:
   # Required for Dart 2.0 collection changes.
-  sdk: '>=2.0.0-dev.49.0 <2.0.0'
+  sdk: '>=2.0.0-dev.55.0 <2.0.0'
 
 dev_dependencies:
   build_runner: ^0.8.0
diff --git a/test/canonicalized_map_test.dart b/test/canonicalized_map_test.dart
index 4049d85..078e57c 100644
--- a/test/canonicalized_map_test.dart
+++ b/test/canonicalized_map_test.dart
@@ -155,8 +155,8 @@
       expect(map, {"01": "value 01", "2": "value 2"});
     });
 
-    test("retype returns a new map instance", () {
-      expect(map.retype<Pattern, Pattern>(), isNot(same(map)));
+    test("cast returns a new map instance", () {
+      expect(map.cast<Pattern, Pattern>(), isNot(same(map)));
     });
   });
 
diff --git a/test/queue_list_test.dart b/test/queue_list_test.dart
index ed26a65..639eb68 100644
--- a/test/queue_list_test.dart
+++ b/test/queue_list_test.dart
@@ -253,11 +253,6 @@
     });
   });
 
-  test("cast uses the same QueueList if possible", () {
-    var queue = new QueueList<String>();
-    expect(queue.cast<Pattern>(), same(queue));
-  }, skip: isDart2 ? false : 'Requires a Dart2 runtime');
-
   test("cast does not throw on mutation when the type is valid", () {
     var patternQueue = new QueueList<Pattern>()..addAll(['a', 'b']);
     var stringQueue = patternQueue.cast<String>();
@@ -294,9 +289,9 @@
     );
   });
 
-  test("retype returns a new QueueList", () {
+  test("cast returns a new QueueList", () {
     var queue = new QueueList<String>();
-    expect(queue.retype<Pattern>(), isNot(same(queue)));
+    expect(queue.cast<Pattern>(), isNot(same(queue)));
   });
 }