Skip to content

Commit

Permalink
Fix ignore on FutureOr
Browse files Browse the repository at this point in the history
I'll look into adding tests - these eventually supposed to *not* get ignored (see #27223)

R=leafp@google.com

Review-Url: https://codereview.chromium.org/2788933002 .
  • Loading branch information
vsmenon committed Mar 31, 2017
1 parent 82beee0 commit 08f0857
Show file tree
Hide file tree
Showing 11 changed files with 774 additions and 637 deletions.
348 changes: 190 additions & 158 deletions pkg/dev_compiler/lib/js/amd/dart_sdk.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/js/amd/dart_sdk.js.map

Large diffs are not rendered by default.

348 changes: 190 additions & 158 deletions pkg/dev_compiler/lib/js/common/dart_sdk.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/js/common/dart_sdk.js.map

Large diffs are not rendered by default.

348 changes: 190 additions & 158 deletions pkg/dev_compiler/lib/js/es6/dart_sdk.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/js/es6/dart_sdk.js.map

Large diffs are not rendered by default.

348 changes: 190 additions & 158 deletions pkg/dev_compiler/lib/js/legacy/dart_sdk.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/dev_compiler/lib/js/legacy/dart_sdk.js.map

Large diffs are not rendered by default.

Binary file modified pkg/dev_compiler/lib/sdk/ddc_sdk.sum
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,16 @@ final _ignoreTypeFailure = JS(
// TODO(vsm): Remove this hack ...
// This is primarily due to the lack of generic methods,
// but we need to triage all the types.
if ($_isFutureOr(type)) {
// Ignore if we would ignore either side of union.
let typeArg = $getGenericArgs(type)[0];
let typeFuture = ${getGenericClass(Future)}(typeArg);
return $_ignoreTypeFailure(actual, typeFuture) ||
$_ignoreTypeFailure(actual, typeArg);
}
if (!!$isSubtype(type, $Iterable) && !!$isSubtype(actual, $Iterable) ||
!!$isSubtype(type, $FutureOr) && !!$isSubtype(actual, $Future) ||
!!$isSubtype(type, $Future) && !!$isSubtype(actual, $Future) ||
!!$isSubtype(type, $Map) && !!$isSubtype(actual, $Map) ||
$isFunctionType(type) && $isFunctionType(actual) ||
!!$isSubtype(type, $Stream) && !!$isSubtype(actual, $Stream) ||
Expand Down
1 change: 1 addition & 0 deletions pkg/dev_compiler/tool/sdk_expected_errors.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[error] A value of type 'Future<Null>' can't be assigned to a variable of type '_Future'. (dart:async/future.dart, line 138, col 38)
[error] Couldn't infer type parameter 'T'.

Tried to infer '_ControllerEventSinkWrapper<dynamic>' for 'T' which doesn't work:
Expand Down

0 comments on commit 08f0857

Please sign in to comment.