Chromium Code Reviews| Index: pkg/analyzer/test/src/task/strong/checker_test.dart |
| diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart |
| index 09738bd19cc465d46b5df8ec364984d366c1ef7a..9cda69e7e0fb3ceea9e0865f9ca6f09055a53a17 100644 |
| --- a/pkg/analyzer/test/src/task/strong/checker_test.dart |
| +++ b/pkg/analyzer/test/src/task/strong/checker_test.dart |
| @@ -28,16 +28,22 @@ void main() { |
| Comparator<K> _comparator; |
| _Predicate _validKey; |
| - // TODO(rnystrom): Initializing _comparator should have a cast, since |
| - // K may not always be Comparable. It doesn't currently get one |
| - // because we're using the spec's LUB on function types, which isn't |
| - // sound. |
| + // The warning on assigning to _comparator is legitimate. Since K has |
| + // no bound, all we know is that it's object. _comparator's function |
| + // type is effectively: (Object, Object) -> int |
| + // We are assigning it a fn of type: (Comparable, Comparable) -> int |
| + // There's no telling if that will work. For example, consider: |
| + // |
| + // new SplayTreeMap<Uri>(); |
| + // |
| + // This would end up calling .compareTo() on a Uri, which doesn't |
| + // define that since it doesn't implement Comparable. |
| SplayTreeMap([int compare(K key1, K key2), |
| bool isValidKey(potentialKey)]) |
| - : _comparator = (compare == null) ? Comparable.compare : compare, |
| + : _comparator = /*warning:FIELD_INITIALIZER_NOT_ASSIGNABLE*/(compare == null) ? Comparable.compare : compare, |
| _validKey = (isValidKey != null) ? isValidKey : ((v) => true) { |
| - _Predicate<Object> v = /*warning:DOWN_CAST_COMPOSITE*/(isValidKey != null) |
|
Leaf
2016/03/22 00:02:20
\o/
|
| - ? isValidKey : (/*info:INFERRED_TYPE_CLOSURE*/(_) => true); |
| + _Predicate<Object> v = (isValidKey != null) |
| + ? isValidKey : (/*info:INFERRED_TYPE_CLOSURE*/(_) => true); |
| v = (isValidKey != null) |
| ? v : (/*info:INFERRED_TYPE_CLOSURE*/(_) => true); |