f021a7019b
fixes #27625, Object constraints were not tracked in inference fixes #27933, pin return type from downwards inference We now prefer to pick the bound (lower or upper) that had some information on, and it also improves inference error messages somewhat (still a ways to go). The way this works is we now have a type representing an unknown type: ?. We use ? when performing downward inference steps, instead of `dynamic`. This allows more accurate tracking of type constraints. For example: given: var x = await Future.wait([a, b]); Future.wait<T>'s argument type is Iterable<Future<T>>. Since we didn't know T, we previously pushed down Iterable<Future<dynamic>>. The dynamic caused loss of information. Now we push down Iterable<Future<?>>, allowing us to infer the right type there. R=leafp@google.com, vsm@google.com Review-Url: https://codereview.chromium.org/2456803004 .
26 lines
899 B
JavaScript
26 lines
899 B
JavaScript
define(['dart_sdk'], function(dart_sdk) {
|
|
'use strict';
|
|
const core = dart_sdk.core;
|
|
const math = dart_sdk.math;
|
|
const dart = dart_sdk.dart;
|
|
const dartx = dart_sdk.dartx;
|
|
const map_keys = Object.create(null);
|
|
let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
|
|
map_keys.main = function() {
|
|
core.print(dart.map({'1': 2, '3': 4, '5': 6}));
|
|
core.print(dart.map([1, 2, 3, 4, 5, 6]));
|
|
core.print(dart.map({'1': 2, [dart.str`${dart.notNull(math.Random.new().nextInt(2)) + 2}`]: 4, '5': 6}));
|
|
let x = '3';
|
|
core.print(dart.map(['1', 2, x, 4, '5', 6]));
|
|
core.print(dart.map(['1', 2, null, 4, '5', 6]));
|
|
};
|
|
dart.fn(map_keys.main, VoidTodynamic());
|
|
dart.trackLibraries("map_keys", {"map_keys.dart": map_keys}, null);
|
|
// Exports:
|
|
return {
|
|
map_keys: map_keys
|
|
};
|
|
});
|
|
|
|
//# sourceMappingURL=map_keys.js.map
|