Chromium Code Reviews| Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
| diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
| index abc476d54c70615a597a402851cb59b79606b444..7aa86153beba0f2f1f4d5082aea4d017bc07d680 100644 |
| --- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
| +++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
| @@ -655,16 +655,6 @@ isFunctionSubtype(ft1, ft2, isCovariant) => JS( |
| // Check return type last, so that arity mismatched functions can be |
| // definitively rejected. |
| - |
| - // We allow any type to subtype a void return type, but not vice versa |
| - if (ret2 === $_void) return true; |
| - // Dart allows void functions to subtype dynamic functions, but not |
| - // other functions. |
| - // TODO(jmesserly): this check does not match our compile time subtype |
| - // implementation. Reconcile. |
| - if (ret1 === $_void) { |
| - return ret2 === $dynamic || ret2 === $FutureOr; |
|
Leaf
2017/02/06 21:11:59
For now, can you keep this test? Deleting it is w
Jennifer Messerly
2017/02/06 22:50:12
okay, sure, it should be _isTop(ret2) then?
Leaf
2017/02/06 22:55:54
Yep, that would be the best fix.
|
| - } |
| if (!$_isSubtype(ret1, ret2, $isCovariant)) return null; |
| return true; |
| })()'''); |
| @@ -698,13 +688,14 @@ _subtypeMemo(f) => JS( |
| final isSubtype = JS( |
| '', '$_subtypeMemo((t1, t2) => (t1 === t2) || $_isSubtype(t1, t2, true))'); |
| -_isBottom(type) => JS('bool', '# == #', type, bottom); |
| +_isBottom(type) => JS('bool', '# == # || # == #', type, bottom, type, Null); |
| _isTop(type) { |
| if (JS('bool', '# === #', getGenericClass(type), getGenericClass(FutureOr))) { |
| return _isTop(JS('', '#[0]', getGenericArgs(type))); |
| } |
| - return JS('bool', '# == # || # == #', type, Object, type, dynamic); |
| + return JS('bool', '# == # || # == # || # == #', |
| + type, Object, type, dynamic, type, _void); |
| } |
| _isSubtype(t1, t2, isCovariant) => JS( |