34f9734b41
This reverts commit 14032a6209.
Reason for revert : Several customer flutter tests are failing because
of the change in behavior.
TEST=revert of previous CL.
Change-Id: Ia235aa93b9c81fbab066803dc0625856f93acceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
314 lines
12 KiB
Plaintext
314 lines
12 KiB
Plaintext
library /*isNonNullableByDefault*/;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:14:7: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// foo(late int x) {} // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:17:5: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// bar(late int x) {} // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:22:28: Error: 'catch' must be followed by '(identifier)' or '(identifier, identifier)'.
|
|
// No types are needed, the first is given by 'on', the second is always 'StackTrace'.
|
|
// } on dynamic catch (late e, late t) {} // Error.
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:22:31: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// } on dynamic catch (late e, late t) {} // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:22:36: Error: 'catch' must be followed by '(identifier)' or '(identifier, identifier)'.
|
|
// No types are needed, the first is given by 'on', the second is always 'StackTrace'.
|
|
// } on dynamic catch (late e, late t) {} // Error.
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:23:8: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// for (late int i = 0; i < 10; ++i) { // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:26:8: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// for (late String s in ["baz"]) { // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:29:9: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// [for (late int i = 0; i < 10; ++i) i]; // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:33:14: Error: Can't have modifier 'late' here.
|
|
// Try removing 'late'.
|
|
// await for (late String s in new Stream.fromIterable(["hest"])) { // Error.
|
|
// ^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:40:20: Error: `await` expressions are not supported in late local initializers.
|
|
// late String s1 = await hest(); // Error.
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:41:30: Error: `await` expressions are not supported in late local initializers.
|
|
// late String s2 = '${fisk}${await hest()}${fisk}'; // Error.
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/late_lowering/later.dart:46:18: Error: Can't have a late final field in a class with a const constructor.
|
|
// late final int x = 42;
|
|
// ^
|
|
// pkg/front_end/testcases/late_lowering/later.dart:48:9: Context: This constructor is const.
|
|
// const B(); // Error: B has late final fields.
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
import "dart:_internal" as _in;
|
|
import "dart:async" as asy;
|
|
|
|
class A extends core::Object {
|
|
field core::int a = 42;
|
|
field core::int? _#A#b = null;
|
|
field core::bool _#A#b#isSet = false;
|
|
synthetic constructor •() → self::A
|
|
: super core::Object::•()
|
|
;
|
|
get b() → core::int {
|
|
if(!this.{self::A::_#A#b#isSet}) {
|
|
this.{self::A::_#A#b} = this.{self::A::a}.{core::num::*}(2).{core::int::>>}(1);
|
|
this.{self::A::_#A#b#isSet} = true;
|
|
}
|
|
return let final core::int? #t1 = this.{self::A::_#A#b} in #t1{core::int};
|
|
}
|
|
set b(core::int #t2) → void {
|
|
this.{self::A::_#A#b#isSet} = true;
|
|
this.{self::A::_#A#b} = #t2;
|
|
}
|
|
method foo(core::int x) → dynamic {}
|
|
}
|
|
class B extends core::Object /*hasConstConstructor*/ {
|
|
field core::int? _#B#x = null;
|
|
field core::bool _#B#x#isSet = false;
|
|
const constructor •() → self::B
|
|
: super core::Object::•()
|
|
;
|
|
get x() → core::int {
|
|
if(!this.{self::B::_#B#x#isSet}) {
|
|
final core::int #t3 = 42;
|
|
if(this.{self::B::_#B#x#isSet})
|
|
throw new _in::LateError::fieldADI("x");
|
|
this.{self::B::_#B#x} = #t3;
|
|
this.{self::B::_#B#x#isSet} = true;
|
|
}
|
|
return let final core::int? #t4 = this.{self::B::_#B#x} in #t4{core::int};
|
|
}
|
|
}
|
|
class C extends core::Object {
|
|
field core::int? _#C#x = null;
|
|
field core::bool _#C#x#isSet = false;
|
|
synthetic constructor •() → self::C
|
|
: super core::Object::•()
|
|
;
|
|
get x() → core::int
|
|
return this.{self::C::_#C#x#isSet} ?{core::int} let final core::int? #t5 = this.{self::C::_#C#x} in #t5{core::int} : throw new _in::LateError::fieldNI("x");
|
|
set x(core::int #t6) → void
|
|
if(this.{self::C::_#C#x#isSet})
|
|
throw new _in::LateError::fieldAI("x");
|
|
else {
|
|
this.{self::C::_#C#x#isSet} = true;
|
|
this.{self::C::_#C#x} = #t6;
|
|
}
|
|
method initVars() → dynamic {
|
|
this.{self::C::x} = 42;
|
|
}
|
|
}
|
|
static method bar(core::int x) → dynamic {}
|
|
static method baz() → dynamic {
|
|
{
|
|
{
|
|
invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:22:36: Error: 'catch' must be followed by '(identifier)' or '(identifier, identifier)'.
|
|
No types are needed, the first is given by 'on', the second is always 'StackTrace'.
|
|
} on dynamic catch (late e, late t) {} // Error.
|
|
^";
|
|
}
|
|
try {
|
|
throw "baz";
|
|
}
|
|
on dynamic catch(final dynamic late, final core::StackTrace e) {
|
|
}
|
|
}
|
|
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
|
|
core::print("baz");
|
|
}
|
|
{
|
|
core::Iterator<core::String> :sync-for-iterator = core::_GrowableList::_literal1<core::String>("baz").{core::Iterable::iterator};
|
|
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
|
|
core::String s = :sync-for-iterator.{core::Iterator::current};
|
|
{
|
|
core::print(s);
|
|
}
|
|
}
|
|
}
|
|
block {
|
|
final core::List<core::int> #t7 = core::_GrowableList::•<core::int>(0);
|
|
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1))
|
|
#t7.{core::List::add}{Invariant}(i);
|
|
} =>#t7;
|
|
}
|
|
static method hest() → dynamic /* originally async */ {
|
|
final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
|
|
core::bool* :is_sync = false;
|
|
FutureOr<dynamic>? :return_value;
|
|
(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;
|
|
dynamic :saved_try_context_var1;
|
|
dynamic :exception0;
|
|
dynamic :stack_trace0;
|
|
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
|
|
try {
|
|
#L1:
|
|
{
|
|
{
|
|
asy::Stream<core::String> :stream = asy::Stream::fromIterable<core::String>(core::_GrowableList::_literal1<core::String>("hest"));
|
|
asy::_StreamIterator<core::String>? :for-iterator = new asy::_StreamIterator::•<core::String>(:stream);
|
|
try
|
|
#L2:
|
|
while (true) {
|
|
dynamic #t8 = asy::_asyncStarMoveNextHelper(:stream);
|
|
[yield] let dynamic #t9 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
|
|
if(_in::unsafeCast<core::bool>(:result)) {
|
|
core::String s = :for-iterator.{asy::_StreamIterator::current};
|
|
{
|
|
core::print(s);
|
|
}
|
|
}
|
|
else
|
|
break #L2;
|
|
}
|
|
finally
|
|
if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
|
|
[yield] let dynamic #t10 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
|
|
:result;
|
|
}
|
|
}
|
|
:return_value = "hest";
|
|
break #L1;
|
|
}
|
|
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
|
return;
|
|
}
|
|
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
|
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
|
}
|
|
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
|
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
|
:async_op.call();
|
|
:is_sync = true;
|
|
return :async_future;
|
|
}
|
|
static method fisk() → dynamic /* originally async */ {
|
|
final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
|
|
core::bool* :is_sync = false;
|
|
FutureOr<dynamic>? :return_value;
|
|
(dynamic) → dynamic :async_op_then;
|
|
(core::Object, core::StackTrace) → dynamic :async_op_error;
|
|
core::int :await_jump_var = 0;
|
|
dynamic :await_ctx_var;
|
|
function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding
|
|
try {
|
|
#L3:
|
|
{
|
|
lowered core::String? #s1;
|
|
lowered core::bool #s1#isSet = false;
|
|
function #s1#get() → core::String {
|
|
if(!#s1#isSet) {
|
|
#s1 = invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:40:20: Error: `await` expressions are not supported in late local initializers.
|
|
late String s1 = await hest(); // Error.
|
|
^^^^^";
|
|
#s1#isSet = true;
|
|
}
|
|
return #s1{core::String};
|
|
}
|
|
function #s1#set(core::String #t11) → dynamic {
|
|
#s1#isSet = true;
|
|
return #s1 = #t11;
|
|
}
|
|
lowered core::String? #s2;
|
|
lowered core::bool #s2#isSet = false;
|
|
function #s2#get() → core::String {
|
|
if(!#s2#isSet) {
|
|
#s2 = "${#C1}${invalid-expression "pkg/front_end/testcases/late_lowering/later.dart:41:30: Error: `await` expressions are not supported in late local initializers.
|
|
late String s2 = '\${fisk}\${await hest()}\${fisk}'; // Error.
|
|
^^^^^"}${#C1}";
|
|
#s2#isSet = true;
|
|
}
|
|
return #s2{core::String};
|
|
}
|
|
function #s2#set(core::String #t12) → dynamic {
|
|
#s2#isSet = true;
|
|
return #s2 = #t12;
|
|
}
|
|
lowered core::Function? #f;
|
|
lowered core::bool #f#isSet = false;
|
|
function #f#get() → core::Function {
|
|
if(!#f#isSet) {
|
|
#f = () → asy::Future<dynamic> /* originally async */ {
|
|
final asy::_Future<dynamic> :async_future = new asy::_Future::•<dynamic>();
|
|
core::bool* :is_sync = false;
|
|
FutureOr<dynamic>? :return_value;
|
|
(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 {
|
|
#L4:
|
|
{
|
|
[yield] let dynamic #t13 = asy::_awaitHelper(self::hest(), :async_op_then, :async_op_error, :async_op) in null;
|
|
:return_value = :result;
|
|
break #L4;
|
|
}
|
|
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
|
return;
|
|
}
|
|
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
|
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
|
}
|
|
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
|
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
|
:async_op.call();
|
|
:is_sync = true;
|
|
return :async_future;
|
|
};
|
|
#f#isSet = true;
|
|
}
|
|
return #f{core::Function};
|
|
}
|
|
function #f#set(core::Function #t14) → dynamic {
|
|
#f#isSet = true;
|
|
return #f = #t14;
|
|
}
|
|
}
|
|
asy::_completeOnAsyncReturn(:async_future, :return_value, :is_sync);
|
|
return;
|
|
}
|
|
on dynamic catch(dynamic exception, core::StackTrace stack_trace) {
|
|
asy::_completeOnAsyncError(:async_future, exception, stack_trace, :is_sync);
|
|
}
|
|
:async_op_then = asy::_asyncThenWrapperHelper(:async_op);
|
|
:async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
|
|
:async_op.call();
|
|
:is_sync = true;
|
|
return :async_future;
|
|
}
|
|
static method main() → dynamic {}
|
|
|
|
constants {
|
|
#C1 = tearoff self::fisk
|
|
}
|