Revert "[vm/kernel] Preserve strong mode types in async transformation"
This reverts commit eec96f9076c552112ccb0b8ff3f8aa36523e9377.
Revert "[vm/kernel] In async transformation check if strongMode is on."
This reverts commit 348ed30efdd88dab74e2bddf6f4affa545ecff10.
Reason for revert: getStaticType is unreliable in Kernel
R=alexmarkov@google.com
Change-Id: I08b914f947a00923491bb610ed74d6348882554f
Reviewed-on: https://dart-review.googlesource.com/75220
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
diff --git a/pkg/front_end/testcases/async_nested.dart.strong.transformed.expect b/pkg/front_end/testcases/async_nested.dart.strong.transformed.expect
index 17767e7..39cfaaf 100644
--- a/pkg/front_end/testcases/async_nested.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/async_nested.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class Node extends core::Object {
final field core::List<self::Node> nested;
@@ -35,16 +34,16 @@
core::String expected = "1 2 3 4 5 6 7 8 9 10";
:async_temporary_2 = new self::Node::•("2", <self::Node>[]);
[yield] let dynamic #t4 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("7", <self::Node>[])), :async_op_then, :async_op_error, :async_op) in null;
- [yield] let dynamic #t5 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("6", <self::Node>[_in::unsafeCast<self::Node>(:result)])), :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t5 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("6", <self::Node>[:result])), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_1 = :result;
[yield] let dynamic #t6 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("8", <self::Node>[])), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
[yield] let dynamic #t7 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("9", <self::Node>[])), :async_op_then, :async_op_error, :async_op) in null;
- [yield] let dynamic #t8 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("4", <self::Node>[new self::Node::•("5", <self::Node>[_in::unsafeCast<self::Node>(:async_temporary_1), _in::unsafeCast<self::Node>(:async_temporary_0), _in::unsafeCast<self::Node>(:result)])])), :async_op_then, :async_op_error, :async_op) in null;
- [yield] let dynamic #t9 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("3", <self::Node>[_in::unsafeCast<self::Node>(:result)])), :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t8 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("4", <self::Node>[new self::Node::•("5", <self::Node>[:async_temporary_1, :async_temporary_0, :result])])), :async_op_then, :async_op_error, :async_op) in null;
+ [yield] let dynamic #t9 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("3", <self::Node>[:result])), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
[yield] let dynamic #t10 = asy::_awaitHelper(asy::Future::value<self::Node>(new self::Node::•("10", <self::Node>[])), :async_op_then, :async_op_error, :async_op) in null;
- self::Node node = new self::Node::•("1", <self::Node>[_in::unsafeCast<self::Node>(:async_temporary_2), _in::unsafeCast<self::Node>(:async_temporary_0), _in::unsafeCast<self::Node>(:result)]);
+ self::Node node = new self::Node::•("1", <self::Node>[:async_temporary_2, :async_temporary_0, :result]);
core::String actual = node.{self::Node::toSimpleString}() as{TypeError} core::String;
core::print(actual);
if(!actual.{core::String::==}(expected)) {
diff --git a/pkg/front_end/testcases/bug33206.dart.strong.transformed.expect b/pkg/front_end/testcases/bug33206.dart.strong.transformed.expect
index 5643449..072c2fe 100644
--- a/pkg/front_end/testcases/bug33206.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/bug33206.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class X extends core::Object {
final field dynamic x;
@@ -90,10 +89,10 @@
{
final self::Y #t1 = new self::Y::•();
[yield] let dynamic #t2 = asy::_awaitHelper(self::f1(), :async_op_then, :async_op_error, :async_op) in null;
- final dynamic #t3 = #t1.{self::Y::f}(_in::unsafeCast<core::List<core::Object>>(:result));
+ final dynamic #t3 = #t1.{self::Y::f}(:result);
final dynamic #t4 = #t1.{self::Y::f}(self::f2());
[yield] let dynamic #t5 = asy::_awaitHelper(self::f3(), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = new self::X::•(#t1, _in::unsafeCast<core::Object>(:result));
+ :return_value = new self::X::•(#t1, :result);
break #L3;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -122,7 +121,7 @@
#L4:
{
[yield] let dynamic #t6 = asy::_awaitHelper(self::foo(), :async_op_then, :async_op_error, :async_op) in null;
- core::print(_in::unsafeCast<self::X>(:result));
+ core::print(:result);
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
index 353e4cf..e437f50 100644
--- a/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
abstract class MyFuture extends core::Object implements asy::Future<core::int> {
synthetic constructor •() → void
@@ -303,25 +302,25 @@
return :async_completer.{asy::Completer::future};
}
[yield] let dynamic #t1 = asy::_awaitHelper(x0, :async_op_then, :async_op_error, :async_op) in null;
- core::int y0 = _in::unsafeCast<core::int>(:result);
+ core::int y0 = :result;
[yield] let dynamic #t2 = asy::_awaitHelper(x1, :async_op_then, :async_op_error, :async_op) in null;
- core::int y1 = _in::unsafeCast<core::int>(:result);
+ core::int y1 = :result;
[yield] let dynamic #t3 = asy::_awaitHelper(x2, :async_op_then, :async_op_error, :async_op) in null;
- asy::Future<core::int> y2 = _in::unsafeCast<asy::Future<core::int>>(:result);
+ asy::Future<core::int> y2 = :result;
[yield] let dynamic #t4 = asy::_awaitHelper(x3, :async_op_then, :async_op_error, :async_op) in null;
- asy::FutureOr<core::int> y3 = _in::unsafeCast<asy::FutureOr<core::int>>(:result);
+ asy::FutureOr<core::int> y3 = :result;
[yield] let dynamic #t5 = asy::_awaitHelper(x4, :async_op_then, :async_op_error, :async_op) in null;
- self::MyFuture y4 = _in::unsafeCast<self::MyFuture>(:result);
+ self::MyFuture y4 = :result;
[yield] let dynamic #t6 = asy::_awaitHelper(x5, :async_op_then, :async_op_error, :async_op) in null;
- core::int y5 = _in::unsafeCast<core::int>(:result);
+ core::int y5 = :result;
[yield] let dynamic #t7 = asy::_awaitHelper(x6, :async_op_then, :async_op_error, :async_op) in null;
- asy::Future<core::int> y6 = _in::unsafeCast<asy::Future<core::int>>(:result);
+ asy::Future<core::int> y6 = :result;
[yield] let dynamic #t8 = asy::_awaitHelper(x7, :async_op_then, :async_op_error, :async_op) in null;
- asy::FutureOr<core::int> y7 = _in::unsafeCast<asy::FutureOr<core::int>>(:result);
+ asy::FutureOr<core::int> y7 = :result;
[yield] let dynamic #t9 = asy::_awaitHelper(x8, :async_op_then, :async_op_error, :async_op) in null;
- self::MyFuture y8 = _in::unsafeCast<self::MyFuture>(:result);
+ self::MyFuture y8 = :result;
[yield] let dynamic #t10 = asy::_awaitHelper(x9, :async_op_then, :async_op_error, :async_op) in null;
- core::int y9 = _in::unsafeCast<core::int>(:result);
+ core::int y9 = :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect
index 562bee8..510f5e8 100644
--- a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method main() → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<dynamic>();
@@ -47,7 +46,7 @@
asy::Future<dynamic> y = f.call();
asy::Future<core::String> z = f.call();
[yield] let dynamic #t1 = asy::_awaitHelper(f.call(), :async_op_then, :async_op_error, :async_op) in null;
- core::String s = _in::unsafeCast<core::Null>(:result);
+ core::String s = :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect
index 26f025e..3b73b9c 100644
--- a/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_async_star.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method main() → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<dynamic>();
@@ -55,7 +54,7 @@
asy::Stream<dynamic> y = f.call();
asy::Stream<core::String> z = f.call();
[yield] let dynamic #t1 = asy::_awaitHelper(f.call().{asy::Stream::first}, :async_op_then, :async_op_error, :async_op) in null;
- core::String s = _in::unsafeCast<core::Null>(:result);
+ core::String s = :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect
index ef93ec0..fdda593 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_async_await.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method main() → asy::Future<dynamic> /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<dynamic>();
@@ -19,9 +18,9 @@
{
dynamic d;
[yield] let dynamic #t1 = asy::_awaitHelper(<core::int>[d as{TypeError} core::int], :async_op_then, :async_op_error, :async_op) in null;
- core::List<core::int> l0 = _in::unsafeCast<core::List<core::int>>(:result);
+ core::List<core::int> l0 = :result;
[yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::value<core::List<core::int>>(<core::int>[d as{TypeError} core::int]), :async_op_then, :async_op_error, :async_op) in null;
- core::List<core::int> l1 = _in::unsafeCast<core::List<core::int>>(:result);
+ core::List<core::int> l1 = :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect
index d174a2f..60d8dbb 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_for_each.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
abstract class MyStream<T extends core::Object = dynamic> extends asy::Stream<self::MyStream::T> {
static factory •<T extends core::Object = dynamic>() → self::MyStream<self::MyStream::•::T>
@@ -50,7 +49,7 @@
while (true) {
dynamic #t3 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t4 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
dynamic x = :for-iterator.{asy::_StreamIterator::current};
{}
}
@@ -73,7 +72,7 @@
while (true) {
dynamic #t6 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t7 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
dynamic x = :for-iterator.{asy::_StreamIterator::current};
{}
}
@@ -96,7 +95,7 @@
while (true) {
dynamic #t9 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t10 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
core::Object x = :for-iterator.{asy::_StreamIterator::current};
{}
}
@@ -119,7 +118,7 @@
while (true) {
dynamic #t12 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t13 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final dynamic #t14 = :for-iterator.{asy::_StreamIterator::current};
{
d = #t14;
@@ -144,7 +143,7 @@
while (true) {
dynamic #t16 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t17 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final core::Object #t18 = :for-iterator.{asy::_StreamIterator::current};
{
o = #t18;
@@ -204,7 +203,7 @@
while (true) {
dynamic #t20 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t21 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
core::int x = :for-iterator.{asy::_StreamIterator::current};
{}
}
@@ -227,7 +226,7 @@
while (true) {
dynamic #t23 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t24 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
core::int x = :for-iterator.{asy::_StreamIterator::current};
{}
}
diff --git a/pkg/front_end/testcases/inference/for_each_downcast_iterable.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/for_each_downcast_iterable.dart.strong.transformed.expect
index faa9884..abfce65 100644
--- a/pkg/front_end/testcases/inference/for_each_downcast_iterable.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/for_each_downcast_iterable.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method test() → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<dynamic>();
@@ -33,7 +32,7 @@
while (true) {
dynamic #t1 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t2 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
dynamic x = :for-iterator.{asy::_StreamIterator::current};
{}
}
@@ -60,7 +59,7 @@
while (true) {
dynamic #t5 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t6 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final dynamic #t7 = :for-iterator.{asy::_StreamIterator::current};
{
y = #t7 as{TypeError} core::int;
diff --git a/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect
index 18ab021..8b41d75 100644
--- a/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -38,7 +37,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -67,7 +66,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect
index 3648d5c..7927f17 100644
--- a/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -38,7 +37,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -67,7 +66,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect
index d8d112a..775141b 100644
--- a/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -38,7 +37,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -67,7 +66,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect
index 10a8e11..dacc8a3 100644
--- a/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -38,7 +37,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -67,7 +66,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect
index 0982974..b1614ca 100644
--- a/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -38,7 +37,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -67,7 +66,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect
index 5b0165f..a13a479 100644
--- a/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -38,7 +37,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -67,7 +66,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:result);
+ :return_value = :result;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect
index 182d288..b5a19f3 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -45,7 +44,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -74,7 +73,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (_in::unsafeCast<core::bool>(:result) ?{core::Object} 2 : asy::Future::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (:result ?{core::Object} 2 : asy::Future::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect
index da226cc..b0dbd8f 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -45,7 +44,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -74,7 +73,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (_in::unsafeCast<core::bool>(:result) ?{core::Object} 2 : new self::MyFuture::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (:result ?{core::Object} 2 : new self::MyFuture::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect
index 1c95710..e855e8b 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -45,7 +44,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -74,7 +73,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (_in::unsafeCast<core::bool>(:result) ?{core::Object} 2 : asy::Future::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (:result ?{core::Object} 2 : asy::Future::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect
index f4b49d2..b567ae6 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -45,7 +44,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -74,7 +73,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (_in::unsafeCast<core::bool>(:result) ?{core::Object} 2 : new self::MyFuture::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (:result ?{core::Object} 2 : new self::MyFuture::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect
index a710edd..5bd9628 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -45,7 +44,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(new self::MyFuture::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -74,7 +73,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (_in::unsafeCast<core::bool>(:result) ?{core::Object} 2 : new self::MyFuture::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (:result ?{core::Object} 2 : new self::MyFuture::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect
index eecf17f..03e6d37 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -45,7 +44,7 @@
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::value<core::int>(3), :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -74,7 +73,7 @@
#L2:
{
[yield] let dynamic #t2 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (_in::unsafeCast<core::bool>(:result) ?{core::Object} 2 : asy::Future::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (:result ?{core::Object} 2 : asy::Future::value<core::int>(3)) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect
index b08ab2d..c1cd7d1 100644
--- a/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class MyFuture<T extends core::Object = dynamic> extends core::Object implements asy::Future<self::MyFuture::T> {
constructor •() → void
@@ -46,7 +45,7 @@
else {
:async_temporary_0 = #t1;
}
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0);
+ :return_value = :async_temporary_0;
break #L1;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -75,7 +74,7 @@
#L2:
{
[yield] let dynamic #t3 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = (let final core::int #t4 = _in::unsafeCast<core::int>(:result) in #t4.==(null) ?{core::Object} asy::Future::value<core::int>(3) : #t4) as{TypeError} asy::FutureOr<core::int>;
+ :return_value = (let final core::int #t4 = :result in #t4.==(null) ?{core::Object} asy::Future::value<core::int>(3) : #t4) as{TypeError} asy::FutureOr<core::int>;
break #L2;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_future_return.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_future_return.dart.strong.transformed.expect
index a9c9d22..1bc6ed6 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_future_return.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_future_return.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class A extends core::Object {
synthetic constructor •() → void
@@ -25,7 +24,7 @@
asy::Future<core::List<self::A>> f1 = null;
asy::Future<core::List<self::A>> f2 = null;
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::wait<core::List<self::A>>(<asy::Future<core::List<self::A>>>[f1, f2]), :async_op_then, :async_op_error, :async_op) in null;
- core::List<core::List<self::A>> merged = _in::unsafeCast<core::List<core::List<self::A>>>(:result);
+ core::List<core::List<self::A>> merged = :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_generic_return.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_generic_return.dart.strong.transformed.expect
index 806190b..8a4ec7e 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_generic_return.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_generic_method_with_generic_return.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
static method id<T extends core::Object = dynamic>(self::id::T x) → self::id::T
return x;
@@ -21,7 +20,7 @@
{
asy::Future<core::String> f;
[yield] let dynamic #t1 = asy::_awaitHelper(self::id<asy::FutureOr<core::String>>(f), :async_op_then, :async_op_error, :async_op) in null;
- core::String s = _in::unsafeCast<core::String>(:result);
+ core::String s = :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
diff --git a/pkg/front_end/testcases/inference/future_union_upwards_generic_methods.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_upwards_generic_methods.dart.strong.transformed.expect
index 9cba179..e202cf1 100644
--- a/pkg/front_end/testcases/inference/future_union_upwards_generic_methods.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_upwards_generic_methods.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class A extends core::Object {
synthetic constructor •() → void
@@ -36,9 +35,9 @@
asy::Future<self::C> c = asy::Future::value<self::C>(new self::C::•());
core::List<asy::Future<self::A>> lll = <asy::Future<self::A>>[b, c];
[yield] let dynamic #t1 = asy::_awaitHelper(asy::Future::wait<self::A>(lll), :async_op_then, :async_op_error, :async_op) in null;
- core::List<self::A> result = _in::unsafeCast<core::List<self::A>>(:result);
+ core::List<self::A> result = :result;
[yield] let dynamic #t2 = asy::_awaitHelper(asy::Future::wait<self::A>(<asy::Future<self::A>>[b, c]), :async_op_then, :async_op_error, :async_op) in null;
- core::List<self::A> result2 = _in::unsafeCast<core::List<self::A>>(:result);
+ core::List<self::A> result2 = :result;
core::List<self::A> list = result;
list = result2;
}
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
index 0f133b8..ac769ba 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class Foo extends core::Object {
field core::int bar = 42;
@@ -40,7 +39,7 @@
while (true) {
dynamic #t1 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t2 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
core::String i = :for-iterator.{asy::_StreamIterator::current};
{
core::int x = let<BottomType> _ = null in let final dynamic #t3 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:17:44: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
@@ -102,7 +101,7 @@
while (true) {
dynamic #t6 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t7 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
self::Baz::T i = :for-iterator.{asy::_StreamIterator::current};
{
core::int x = let<BottomType> _ = null in let final dynamic #t8 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:25:44: Error: A value of type 'test::Baz::T' can't be assigned to a variable of type 'dart.core::int'.
@@ -166,7 +165,7 @@
while (true) {
dynamic #t11 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t12 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
self::Foo x = :for-iterator.{asy::_StreamIterator::current};
{
core::String y = let<BottomType> _ = null in let final dynamic #t13 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:38:45: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
@@ -194,7 +193,7 @@
while (true) {
dynamic #t16 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t17 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
dynamic x = :for-iterator.{asy::_StreamIterator::current};
{
core::String y = x as{TypeError} core::String;
@@ -219,7 +218,7 @@
while (true) {
dynamic #t19 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t20 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final self::Foo #t21 = :for-iterator.{asy::_StreamIterator::current};
{
core::String x = let<BottomType> _ = null in let final dynamic #t22 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:45:21: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
@@ -249,7 +248,7 @@
while (true) {
dynamic #t25 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t26 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final self::Foo #t27 = :for-iterator.{asy::_StreamIterator::current};
{
z = #t27;
@@ -276,7 +275,7 @@
while (true) {
dynamic #t29 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t30 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final dynamic #t31 = :for-iterator.{asy::_StreamIterator::current};
{
self::Foo x = #t31 as{TypeError} self::Foo;
@@ -303,7 +302,7 @@
while (true) {
dynamic #t33 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t34 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final dynamic #t35 = :for-iterator.{asy::_StreamIterator::current};
{
self::Foo x = #t35 as{TypeError} self::Foo;
@@ -332,7 +331,7 @@
while (true) {
dynamic #t39 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t40 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
dynamic x = :for-iterator.{asy::_StreamIterator::current};
{
core::String y = x as{TypeError} core::String;
diff --git a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
index 93a1ee8..002d2e6 100644
--- a/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference_new/for_each_invalid_iterable.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
static method test() → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<dynamic>();
@@ -38,7 +37,7 @@
while (true) {
dynamic #t6 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t7 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final dynamic #t8 = :for-iterator.{asy::_StreamIterator::current};
{
core::int x = #t8 as{TypeError} core::int;
@@ -71,7 +70,7 @@
while (true) {
dynamic #t15 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t16 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final dynamic #t17 = :for-iterator.{asy::_StreamIterator::current};
{
y = #t17 as{TypeError} core::int;
diff --git a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
index 6183231..ba7388f 100644
--- a/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart.strong.transformed.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
-import "dart:_internal" as _in;
class A extends core::Object {
synthetic constructor •() → void
@@ -50,7 +49,7 @@
while (true) {
dynamic #t2 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t3 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final self::A #t4 = :for-iterator.{asy::_StreamIterator::current};
{
a = #t4;
@@ -78,7 +77,7 @@
while (true) {
dynamic #t7 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t8 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final self::A #t9 = :for-iterator.{asy::_StreamIterator::current};
{
b = #t9 as{TypeError} self::B;
@@ -109,7 +108,7 @@
while (true) {
dynamic #t14 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t15 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final self::A #t16 = :for-iterator.{asy::_StreamIterator::current};
{
i = let<BottomType> _ = null in let final dynamic #t17 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference_new/for_each_outer_var_type.dart:27:61: Error: A value of type 'test::A' can't be assigned to a variable of type 'dart.core::int'.
@@ -140,7 +139,7 @@
while (true) {
dynamic #t21 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream);
[yield] let dynamic #t22 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
- if(_in::unsafeCast<core::bool>(:result)) {
+ if(:result) {
final self::A #t23 = :for-iterator.{asy::_StreamIterator::current};
{
a = #t23;
diff --git a/pkg/kernel/bin/transform.dart b/pkg/kernel/bin/transform.dart
index d04dda3..9523e33 100755
--- a/pkg/kernel/bin/transform.dart
+++ b/pkg/kernel/bin/transform.dart
@@ -86,8 +86,7 @@
final hierarchy = new ClassHierarchy(component);
switch (options['transformation']) {
case 'continuation':
- component = cont.transformComponent(
- coreTypes, hierarchy, component, syncAsync, true);
+ component = cont.transformComponent(coreTypes, component, syncAsync);
break;
case 'resolve-mixins':
mix.transformLibraries(
diff --git a/pkg/kernel/lib/core_types.dart b/pkg/kernel/lib/core_types.dart
index 0d71623..485074d 100644
--- a/pkg/kernel/lib/core_types.dart
+++ b/pkg/kernel/lib/core_types.dart
@@ -106,8 +106,6 @@
Field _pragmaName;
Field _pragmaOptions;
- Procedure _unsafeCast;
-
CoreTypes(Component component)
: index = new LibraryIndex.coreLibraries(component);
@@ -232,11 +230,6 @@
index.getMember('dart:_internal', 'ExternalName', '');
}
- Procedure get unsafeCast {
- return _unsafeCast ??=
- index.getMember('dart:_internal', '::', 'unsafeCast');
- }
-
Class get functionClass {
return _functionClass ??= index.getClass('dart:core', 'Function');
}
diff --git a/pkg/kernel/lib/transformations/async.dart b/pkg/kernel/lib/transformations/async.dart
index 0d29e7e..7977045 100644
--- a/pkg/kernel/lib/transformations/async.dart
+++ b/pkg/kernel/lib/transformations/async.dart
@@ -111,41 +111,11 @@
return result;
}
- // If expression [from] has a non-dynamic static type then ensure that
- // expression [to] would have the same static type by wrapping it into
- // an appropriate unsafeCast.
- Expression assignType(Expression to, Expression from) {
- final env = continuationRewriter.helper.env;
- if (!env.strongMode) {
- return to;
- }
-
- final fromType = from.getStaticType(env);
- if (fromType == null || fromType == const DynamicType()) {
- return to;
- }
-
- return new StaticInvocation(continuationRewriter.helper.unsafeCast,
- new Arguments(<Expression>[to], types: <DartType>[fromType]));
- }
-
- // Store a value into a temporary variable, dropping unnecessary unsafeCast
- // if present (because all temporaries are of dynamic type).
- VariableSet storeTemporary(VariableDeclaration v, Expression value) {
- assert(v.type == const DynamicType());
- Expression unwrapped = value;
- if (value is StaticInvocation &&
- value.target == continuationRewriter.helper.unsafeCast) {
- unwrapped = value.arguments.positional.first;
- }
- return new VariableSet(v, unwrapped);
- }
-
// Name an expression by emitting an assignment to a temporary variable.
- Expression name(Expression expr) {
+ VariableGet name(Expression expr) {
VariableDeclaration temp = allocateTemporary(nameIndex);
- statements.add(new ExpressionStatement(storeTemporary(temp, expr)));
- return assignType(new VariableGet(temp), expr);
+ statements.add(new ExpressionStatement(new VariableSet(temp, expr)));
+ return new VariableGet(temp);
}
VariableDeclaration allocateTemporary(int index) {
@@ -183,12 +153,11 @@
// Getting a final or const variable is not an effect so it can be evaluated
// after an await to its right.
TreeNode visitVariableGet(VariableGet expr) {
- Expression result = expr;
if (seenAwait && !expr.variable.isFinal && !expr.variable.isConst) {
- result = name(expr);
+ expr = name(expr);
++nameIndex;
}
- return result;
+ return expr;
}
// Transform an expression given an action to transform the children. For
@@ -425,9 +394,9 @@
var thenBody = blockOf(thenStatements);
var otherwiseBody = blockOf(otherwiseStatements);
thenBody.addStatement(
- new ExpressionStatement(storeTemporary(result, expr.then)));
+ new ExpressionStatement(new VariableSet(result, expr.then)));
otherwiseBody.addStatement(
- new ExpressionStatement(storeTemporary(result, expr.otherwise)));
+ new ExpressionStatement(new VariableSet(result, expr.otherwise)));
var branch = new IfStatement(expr.condition, thenBody, otherwiseBody);
statements.add(branch);
@@ -436,14 +405,14 @@
++nameIndex;
seenAwait = seenAwait || thenAwait || otherwiseAwait;
- return assignType(new VariableGet(result), expr);
+ return new VariableGet(result);
}
// Others.
TreeNode visitAwaitExpression(AwaitExpression expr) {
final R = continuationRewriter;
var shouldName = seenAwait;
- var result = assignType(new VariableGet(asyncResult), expr);
+ var result = new VariableGet(asyncResult);
// The statements are in reverse order, so name the result first if
// necessary and then add the two other statements in reverse.
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart
index 56c03a9..723c78d 100644
--- a/pkg/kernel/lib/transformations/continuation.dart
+++ b/pkg/kernel/lib/transformations/continuation.dart
@@ -7,9 +7,7 @@
import 'dart:math' as math;
import '../ast.dart';
-import '../class_hierarchy.dart' show ClassHierarchy;
-import '../core_types.dart' show CoreTypes;
-import '../type_environment.dart' show TypeEnvironment;
+import '../core_types.dart';
import '../visitor.dart';
import 'async.dart';
@@ -25,25 +23,25 @@
static String stackTraceVar(int depth) => ':stack_trace$depth';
}
-void transformLibraries(CoreTypes coreTypes, ClassHierarchy hierarchy,
- List<Library> libraries, bool syncAsync, bool strongMode) {
- var helper = new HelperNodes.fromCoreTypes(coreTypes, hierarchy, strongMode);
+void transformLibraries(
+ CoreTypes coreTypes, List<Library> libraries, bool syncAsync) {
+ var helper = new HelperNodes.fromCoreTypes(coreTypes);
var rewriter = new RecursiveContinuationRewriter(helper, syncAsync);
for (var library in libraries) {
rewriter.rewriteLibrary(library);
}
}
-Component transformComponent(CoreTypes coreTypes, ClassHierarchy hierarchy,
- Component component, bool syncAsync, bool strongMode) {
- var helper = new HelperNodes.fromCoreTypes(coreTypes, hierarchy, strongMode);
+Component transformComponent(
+ CoreTypes coreTypes, Component component, bool syncAsync) {
+ var helper = new HelperNodes.fromCoreTypes(coreTypes);
var rewriter = new RecursiveContinuationRewriter(helper, syncAsync);
return rewriter.rewriteComponent(component);
}
-Procedure transformProcedure(CoreTypes coreTypes, ClassHierarchy hierarchy,
- Procedure procedure, bool syncAsync, bool strongMode) {
- var helper = new HelperNodes.fromCoreTypes(coreTypes, hierarchy, strongMode);
+Procedure transformProcedure(
+ CoreTypes coreTypes, Procedure procedure, bool syncAsync) {
+ var helper = new HelperNodes.fromCoreTypes(coreTypes);
var rewriter = new RecursiveContinuationRewriter(helper, syncAsync);
return rewriter.visitProcedure(procedure);
}
@@ -71,23 +69,7 @@
}
visitProcedure(Procedure node) {
- try {
- if (!node.isStatic) {
- helper.env.thisType = node.enclosingClass?.thisType;
- }
- return node.isAbstract ? node : super.visitProcedure(node);
- } finally {
- helper.env.thisType = null;
- }
- }
-
- visitConstructor(Constructor node) {
- try {
- helper.env.thisType = node.enclosingClass.thisType;
- return super.visitConstructor(node);
- } finally {
- helper.env.thisType = null;
- }
+ return node.isAbstract ? node : super.visitProcedure(node);
}
visitFunctionNode(FunctionNode node) {
@@ -1198,9 +1180,6 @@
final Member syncIteratorYieldEachIterable;
final Class boolClass;
final Member boolFromEnvironment;
- final Procedure unsafeCast;
-
- final TypeEnvironment env;
HelperNodes._(
this.asyncErrorWrapper,
@@ -1244,12 +1223,9 @@
this.syncIteratorCurrent,
this.syncIteratorYieldEachIterable,
this.boolClass,
- this.boolFromEnvironment,
- this.unsafeCast,
- this.env);
+ this.boolFromEnvironment);
- factory HelperNodes.fromCoreTypes(
- CoreTypes coreTypes, ClassHierarchy hierarchy, bool strongMode) {
+ factory HelperNodes.fromCoreTypes(CoreTypes coreTypes) {
return new HelperNodes._(
coreTypes.asyncErrorWrapperHelperProcedure,
coreTypes.asyncLibrary,
@@ -1292,8 +1268,6 @@
coreTypes.syncIteratorCurrent,
coreTypes.syncIteratorYieldEachIterable,
coreTypes.boolClass,
- coreTypes.boolFromEnvironment,
- coreTypes.unsafeCast,
- new TypeEnvironment(coreTypes, hierarchy, strongMode: strongMode));
+ coreTypes.boolFromEnvironment);
}
}
diff --git a/pkg/vm/lib/target/vm.dart b/pkg/vm/lib/target/vm.dart
index 71b799a..0889b46 100644
--- a/pkg/vm/lib/target/vm.dart
+++ b/pkg/vm/lib/target/vm.dart
@@ -66,8 +66,7 @@
logger?.call("Transformed mixin applications");
// TODO(kmillikin): Make this run on a per-method basis.
- transformAsync.transformLibraries(
- coreTypes, hierarchy, libraries, flags.syncAsync, strongMode);
+ transformAsync.transformLibraries(coreTypes, libraries, flags.syncAsync);
logger?.call("Transformed async methods");
callSiteAnnotator.transformLibraries(
@@ -79,8 +78,7 @@
void performTransformationsOnProcedure(
CoreTypes coreTypes, ClassHierarchy hierarchy, Procedure procedure,
{void logger(String msg)}) {
- transformAsync.transformProcedure(
- coreTypes, hierarchy, procedure, flags.syncAsync, strongMode);
+ transformAsync.transformProcedure(coreTypes, procedure, flags.syncAsync);
logger?.call("Transformed async functions");
}
diff --git a/pkg/vm/testcases/bytecode/async.dart.expect b/pkg/vm/testcases/bytecode/async.dart.expect
index 8267a0d..9b27c2d 100644
--- a/pkg/vm/testcases/bytecode/async.dart.expect
+++ b/pkg/vm/testcases/bytecode/async.dart.expect
@@ -2,7 +2,6 @@
import self as self;
import "dart:async" as asy;
import "dart:core" as core;
-import "dart:_internal" as _in;
[@vm.bytecode=
Bytecode {
@@ -263,7 +262,7 @@
#L1:
{
[yield] let dynamic #t1 = asy::_awaitHelper(x, :async_op_then, :async_op_error, :async_op) in null;
- _in::unsafeCast<core::int>(:result);
+ :result;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
return;
@@ -735,7 +734,7 @@
[yield] let dynamic #t2 = asy::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
:async_temporary_0 = :result;
[yield] let dynamic #t3 = asy::_awaitHelper(b, :async_op_then, :async_op_error, :async_op) in null;
- :return_value = _in::unsafeCast<core::int>(:async_temporary_0).{core::num::+}(_in::unsafeCast<core::int>(:result));
+ :return_value = :async_temporary_0.{core::num::+}(:result);
break #L3;
}
asy::_completeOnAsyncReturn(:async_completer, :return_value);
@@ -1161,7 +1160,7 @@
:async_temporary_1 = sum;
:async_temporary_0 = i.{core::num::+}(j);
[yield] let dynamic #t4 = asy::_awaitHelper(self::foo(), :async_op_then, :async_op_error, :async_op) in null;
- sum = _in::unsafeCast<core::int>(:async_temporary_1).{core::num::+}(_in::unsafeCast<core::int>(:async_temporary_0).{core::num::+}(_in::unsafeCast<core::int>(:result)));
+ sum = :async_temporary_1.{core::num::+}(:async_temporary_0.{core::num::+}(:result));
}
}
for (core::int k = 0; k.{core::num::<}(10); k = k.{core::num::+}(1)) {
@@ -1811,7 +1810,7 @@
try {
:async_temporary_0 = x;
[yield] let dynamic #t5 = asy::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- x = _in::unsafeCast<core::int>(:async_temporary_0).{core::num::+}(_in::unsafeCast<core::int>(:result));
+ x = :async_temporary_0.{core::num::+}(:result);
}
on dynamic catch(final dynamic e) {
if(e is core::Error) {
@@ -1820,14 +1819,14 @@
}
:async_temporary_0 = x;
[yield] let dynamic #t6 = asy::_awaitHelper(b, :async_op_then, :async_op_error, :async_op) in null;
- x = _in::unsafeCast<core::int>(:async_temporary_0).{core::num::+}(_in::unsafeCast<core::int>(:result));
+ x = :async_temporary_0.{core::num::+}(:result);
rethrow;
}
finally {
core::print("fin");
:async_temporary_0 = x;
[yield] let dynamic #t7 = asy::_awaitHelper(c, :async_op_then, :async_op_error, :async_op) in null;
- x = _in::unsafeCast<core::int>(:async_temporary_0).{core::num::+}(_in::unsafeCast<core::int>(:result));
+ x = :async_temporary_0.{core::num::+}(:result);
:return_value = x;
break #L5;
}
@@ -2210,7 +2209,7 @@
try {
x = 5;
[yield] let dynamic #t8 = asy::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- y = _in::unsafeCast<core::int>(:result);
+ y = :result;
:return_value = x.{core::num::+}(y);
break #L6;
}
@@ -2474,7 +2473,7 @@
{
assert {
[yield] let dynamic #t9 = asy::_awaitHelper(a, :async_op_then, :async_op_error, :async_op) in null;
- assert(_in::unsafeCast<core::int>(:result).{core::num::==}(42));
+ assert(:result.{core::num::==}(42));
}
:return_value = 7;
break #L7;
diff --git a/runtime/tests/vm/dart/async_transform_types_preservation_test.dart b/runtime/tests/vm/dart/async_transform_types_preservation_test.dart
deleted file mode 100644
index c0a774c..0000000
--- a/runtime/tests/vm/dart/async_transform_types_preservation_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2018, 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.
-
-// Verify that async transformer produces correct Kernel ASTs and does
-// not cause crashes in subsequent transformations.
-
-import 'dart:async';
-
-import 'package:expect/expect.dart';
-
-bool global = false;
-
-class Foo<T> {
- final T Function(int) wrap;
- final int Function(T) unwrap;
-
- Foo(this.wrap, this.unwrap);
-
- FutureOr<List<T>> get f => [wrap(21), wrap(20), wrap(1)];
- FutureOr<List<T>> get g => [wrap(-21), wrap(20), wrap(1)];
-
- Future<int> get one async =>
- (global ? await f : await g).map(unwrap).reduce((int a, int b) => a + b);
-
- Future<int> get two async =>
- (await f).map(unwrap).reduce((int a, int b) => a + b);
-}
-
-class Bar {
- final int value;
- Bar(this.value);
-}
-
-void main() async {
- final wrap = (int v) => new Bar(v);
- final unwrap = (Bar b) => b.value;
-
- Expect.equals(0, await new Foo<Bar>(wrap, unwrap).one);
- Expect.equals(42, await new Foo<Bar>(wrap, unwrap).two);
-}