Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 1648063002: Implement the spec's notion of LUB for function types. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix passing test. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/type_system_test.dart ('k') | tests/co19/co19-analyzer2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb8216a0b18875a5b6bdae1554c5fcedce68c106..65de58df5c6d29cac67fa8d1e865ee8a4cfa1a46 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -26,21 +26,19 @@ void main() {
Comparator<K> _comparator;
_Predicate _validKey;
- // Initializing _comparator needs a cast, since K may not always be
- // Comparable.
- // Initializing _validKey shouldn't need a cast. Currently
- // it requires inference to work because of dartbug.com/23381
+ // 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.
SplayTreeMap([int compare(K key1, K key2),
bool isValidKey(potentialKey)]) {
- : _comparator = /*warning:DOWN_CAST_COMPOSITE*/(compare == null)
- ? Comparable.compare : compare,
- _validKey = /*warning:DOWN_CAST_COMPOSITE*/(isValidKey != null)
- ? isValidKey : ((v) => true);
- _Predicate<Object> _v = /*warning:DOWN_CAST_COMPOSITE*/(isValidKey != null)
- ? isValidKey : (/*info:INFERRED_TYPE_CLOSURE*/(v) => true);
- // TODO(leafp): Fix unimplemented LUB in analyzer
- _v = /*warning:DOWN_CAST_COMPOSITE*/(isValidKey != null)
- ? _v : (/*info:INFERRED_TYPE_CLOSURE*/(v) => true);
+ : _comparator = (compare == null) ? Comparable.compare : compare,
+ _validKey = (isValidKey != null) ? isValidKey : ((v) => true);
+ _Predicate<Object> v = /*warning:DOWN_CAST_COMPOSITE*/(isValidKey != null)
+ ? isValidKey : (/*info:INFERRED_TYPE_CLOSURE*/(_) => true);
+
+ v = (isValidKey != null)
+ ? v : (/*info:INFERRED_TYPE_CLOSURE*/(_) => true);
}
}
void main() {
« no previous file with comments | « pkg/analyzer/test/generated/type_system_test.dart ('k') | tests/co19/co19-analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698