blob: 1a2b24210fe0769f74c6b83af238c319e3031073 [file] [log] [blame] [edit]
library;
import self as self;
import "dart:_late_helper" as _la;
import "dart:core" as core;
static method main() void {
self::testNullableUninitializedNonFinalLocal();
self::testNonNullableUninitializedNonFinalLocal();
self::testNullableUninitializedFinalLocal();
self::testNonNullableUninitializedFinalLocal();
self::testNullableInitializedNonFinalLocal();
self::testNonNullableInitializedNonFinalLocal();
self::testNullableInitializedFinalLocal();
self::testNonNullableInitializedFinalLocal();
}
static method testNullableUninitializedNonFinalLocal() void {
final synthesized _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() core::int});
}
static method testNonNullableUninitializedNonFinalLocal() void {
final synthesized _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::value} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() core::int});
}
static method testNullableUninitializedFinalLocal() void {
final synthesized _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() core::int});
}
static method testNonNullableUninitializedFinalLocal() void {
final synthesized _la::_Cell x = new _la::_Cell::named("x");
x.{_la::_Cell::finalLocalValue} = 42;
core::print(x.{_la::_Cell::readLocal}<core::int>(){() core::int});
}
static method testNullableInitializedNonFinalLocal() void {
final synthesized _la::_InitializedCell x = new _la::_InitializedCell::named("x", () core::int? => 1.{core::int::unary-}(){() core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() core::int});
final synthesized _la::_InitializedCell y = new _la::_InitializedCell::named("y", () core::int? => null);
core::print(y.{_la::_InitializedCell::read}<core::int?>(){() core::int?});
y.{_la::_InitializedCell::value} = 42;
core::print(y.{_la::_InitializedCell::read}<core::int>(){() core::int});
}
static method testNonNullableInitializedNonFinalLocal() void {
final synthesized _la::_InitializedCell x = new _la::_InitializedCell::named("x", () core::int => 1.{core::int::unary-}(){() core::int});
core::print(x.{_la::_InitializedCell::read}<core::int>(){() core::int});
x.{_la::_InitializedCell::value} = 42;
core::print(x.{_la::_InitializedCell::read}<core::int>(){() core::int});
}
static method testNullableInitializedFinalLocal() void {
final synthesized _la::_InitializedCell x = new _la::_InitializedCell::named("x", () core::int? => 1.{core::int::unary-}(){() core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int?>(){() core::int?});
final synthesized _la::_InitializedCell y = new _la::_InitializedCell::named("y", () core::int? => null);
core::print(y.{_la::_InitializedCell::readFinal}<core::int?>(){() core::int?});
}
static method testNonNullableInitializedFinalLocal() void {
final synthesized _la::_InitializedCell x = new _la::_InitializedCell::named("x", () core::int => 1.{core::int::unary-}(){() core::int});
core::print(x.{_la::_InitializedCell::readFinal}<core::int>(){() core::int});
}
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_locals.dart:41:17 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_locals.dart:53:16 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_locals.dart:60:23 -> DoubleConstant(-1.0)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///late_locals.dart:68:22 -> DoubleConstant(-1.0)
Extra constant evaluation: evaluated: 81, effectively constant: 4