-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #42540 Change-Id: I8ea8f03a2682a5b52867787144a2d81c7527ca11 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153340 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
- Loading branch information
1 parent
06cb010
commit 1ed7581
Showing
8 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
dynamic getNull() => null; | ||
|
||
Future<Object> fn() async { | ||
Object o = await getNull(); | ||
return await getNull(); | ||
} | ||
|
||
main() {} |
11 changes: 11 additions & 0 deletions
11
pkg/front_end/testcases/nnbd/issue42540.dart.outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:async" as asy; | ||
import "dart:core" as core; | ||
|
||
static method getNull() → dynamic | ||
; | ||
static method fn() → asy::Future<core::Object> | ||
; | ||
static method main() → dynamic | ||
; |
12 changes: 12 additions & 0 deletions
12
pkg/front_end/testcases/nnbd/issue42540.dart.strong.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:async" as asy; | ||
import "dart:core" as core; | ||
|
||
static method getNull() → dynamic | ||
return null; | ||
static method fn() → asy::Future<core::Object> async { | ||
core::Object o = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::Object; | ||
return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object>; | ||
} | ||
static method main() → dynamic {} |
39 changes: 39 additions & 0 deletions
39
pkg/front_end/testcases/nnbd/issue42540.dart.strong.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:async" as asy; | ||
import "dart:core" as core; | ||
|
||
static method getNull() → dynamic | ||
return null; | ||
static method fn() → asy::Future<core::Object> /* originally async */ { | ||
final asy::_AsyncAwaitCompleter<core::Object> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Object>(); | ||
FutureOr<core::Object>? :return_value; | ||
dynamic :async_stack_trace; | ||
(dynamic) → dynamic :async_op_then; | ||
(core::Object, core::StackTrace) → dynamic :async_op_error; | ||
core::int :await_jump_var = 0; | ||
dynamic :await_ctx_var; | ||
dynamic :saved_try_context_var0; | ||
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding | ||
try { | ||
#L1: | ||
{ | ||
[yield] let dynamic #t1 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null; | ||
core::Object o = let dynamic #t2 = :result in #t2.==(null) ?{core::Object} #t2 as{TypeError,ForDynamic,ForNonNullableByDefault} core::Object : #t2{core::Object}; | ||
[yield] let dynamic #t3 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null; | ||
:return_value = let dynamic #t4 = :result in #t4.==(null) ?{FutureOr<core::Object>} #t4 as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object> : #t4{FutureOr<core::Object>}; | ||
break #L1; | ||
} | ||
asy::_completeOnAsyncReturn(:async_completer, :return_value); | ||
return; | ||
} | ||
on dynamic catch(dynamic exception, core::StackTrace stack_trace) { | ||
:async_completer.{asy::Completer::completeError}(exception, stack_trace); | ||
} | ||
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op); | ||
:async_op_then = asy::_asyncThenWrapperHelper(:async_op); | ||
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op); | ||
:async_completer.{asy::_AsyncAwaitCompleter::start}(:async_op); | ||
return :async_completer.{asy::Completer::future}; | ||
} | ||
static method main() → dynamic {} |
3 changes: 3 additions & 0 deletions
3
pkg/front_end/testcases/nnbd/issue42540.dart.textual_outline.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dynamic getNull() => null; | ||
Future<Object> fn() async {} | ||
main() {} |
3 changes: 3 additions & 0 deletions
3
pkg/front_end/testcases/nnbd/issue42540.dart.textual_outline_modelled.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Future<Object> fn() async {} | ||
dynamic getNull() => null; | ||
main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:async" as asy; | ||
import "dart:core" as core; | ||
|
||
static method getNull() → dynamic | ||
return null; | ||
static method fn() → asy::Future<core::Object> async { | ||
core::Object o = await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} core::Object; | ||
return await self::getNull() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<core::Object>; | ||
} | ||
static method main() → dynamic {} |
39 changes: 39 additions & 0 deletions
39
pkg/front_end/testcases/nnbd/issue42540.dart.weak.transformed.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
library /*isNonNullableByDefault*/; | ||
import self as self; | ||
import "dart:async" as asy; | ||
import "dart:core" as core; | ||
|
||
static method getNull() → dynamic | ||
return null; | ||
static method fn() → asy::Future<core::Object> /* originally async */ { | ||
final asy::_AsyncAwaitCompleter<core::Object> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Object>(); | ||
FutureOr<core::Object>? :return_value; | ||
dynamic :async_stack_trace; | ||
(dynamic) → dynamic :async_op_then; | ||
(core::Object, core::StackTrace) → dynamic :async_op_error; | ||
core::int :await_jump_var = 0; | ||
dynamic :await_ctx_var; | ||
dynamic :saved_try_context_var0; | ||
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding | ||
try { | ||
#L1: | ||
{ | ||
[yield] let dynamic #t1 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null; | ||
core::Object o = :result; | ||
[yield] let dynamic #t2 = asy::_awaitHelper(self::getNull(), :async_op_then, :async_op_error, :async_op) in null; | ||
:return_value = :result; | ||
break #L1; | ||
} | ||
asy::_completeOnAsyncReturn(:async_completer, :return_value); | ||
return; | ||
} | ||
on dynamic catch(dynamic exception, core::StackTrace stack_trace) { | ||
:async_completer.{asy::Completer::completeError}(exception, stack_trace); | ||
} | ||
:async_stack_trace = asy::_asyncStackTraceHelper(:async_op); | ||
:async_op_then = asy::_asyncThenWrapperHelper(:async_op); | ||
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op); | ||
:async_completer.{asy::_AsyncAwaitCompleter::start}(:async_op); | ||
return :async_completer.{asy::Completer::future}; | ||
} | ||
static method main() → dynamic {} |