blob: 7ebbdd7d66482ae227076ab0d5d0cacac9fa324d [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
static method foldInitialElements() void {
dynamic element0 = 0;
core::num* element1 = 1;
core::int* element2 = 2;
core::List<core::int*>* list = block {
final core::List<core::int*>* #t1 = core::_GrowableList::_literal3<core::int*>(element0 as{TypeError,ForDynamic} core::int*, element1 as{TypeError} core::int*, element2);
if(true)
#t1.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t1.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t1.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t1.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t1;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t2 = new col::_CompactLinkedHashSet::•<core::int*>();
#t2.{core::Set::add}{Invariant}(element0 as{TypeError,ForDynamic} core::int*){(core::int*) →* core::bool*};
#t2.{core::Set::add}{Invariant}(element1 as{TypeError} core::int*){(core::int*) →* core::bool*};
#t2.{core::Set::add}{Invariant}(element2){(core::int*) →* core::bool*};
if(true)
#t2.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t2.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t2.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t2.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t2;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method foldInitialSpread1() void {
dynamic initial = core::_GrowableList::_literal3<core::int*>(0, 1, 2);
core::List<core::int*>* list = block {
final core::List<core::int*>* #t3 = core::_GrowableList::•<core::int*>(0);
{
core::Iterator<dynamic>* :sync-for-iterator = (initial as{TypeError,ForDynamic} core::Iterable<dynamic>*).{core::Iterable::iterator}{core::Iterator<dynamic>*};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
final dynamic #t4 = :sync-for-iterator.{core::Iterator::current}{dynamic};
{
final core::int* #t5 = #t4 as{TypeError} core::int*;
#t3.{core::List::add}{Invariant}(#t5){(core::int*) →* void};
}
}
}
if(true)
#t3.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t3.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t3.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t3.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t3;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t6 = new col::_CompactLinkedHashSet::•<core::int*>();
{
core::Iterator<dynamic>* :sync-for-iterator = (initial as{TypeError,ForDynamic} core::Iterable<dynamic>*).{core::Iterable::iterator}{core::Iterator<dynamic>*};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
final dynamic #t7 = :sync-for-iterator.{core::Iterator::current}{dynamic};
{
final core::int* #t8 = #t7 as{TypeError} core::int*;
#t6.{core::Set::add}{Invariant}(#t8){(core::int*) →* core::bool*};
}
}
}
if(true)
#t6.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t6.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t6.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t6.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t6;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method foldInitialSpread2() void {
core::Iterable<core::num*>* initial = core::_GrowableList::_literal3<core::num*>(0, 1, 2);
core::List<core::int*>* list = block {
final core::List<core::int*>* #t9 = core::_GrowableList::•<core::int*>(0);
{
core::Iterator<core::num*>* :sync-for-iterator = initial.{core::Iterable::iterator}{core::Iterator<core::num*>*};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
final dynamic #t10 = :sync-for-iterator.{core::Iterator::current}{core::num*};
{
final core::int* #t11 = #t10 as{TypeError} core::int*;
#t9.{core::List::add}{Invariant}(#t11){(core::int*) →* void};
}
}
}
if(true)
#t9.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t9.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t9.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t9.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t9;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t12 = new col::_CompactLinkedHashSet::•<core::int*>();
{
core::Iterator<core::num*>* :sync-for-iterator = initial.{core::Iterable::iterator}{core::Iterator<core::num*>*};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
final dynamic #t13 = :sync-for-iterator.{core::Iterator::current}{core::num*};
{
final core::int* #t14 = #t13 as{TypeError} core::int*;
#t12.{core::Set::add}{Invariant}(#t14){(core::int*) →* core::bool*};
}
}
}
if(true)
#t12.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t12.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t12.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t12.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t12;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method foldInitialSpread3() void {
core::List<core::num*>* initial = core::_GrowableList::_literal3<core::num*>(0, 1, 2);
core::List<core::int*>* list = block {
final core::List<core::int*>* #t15 = core::_GrowableList::•<core::int*>(0);
{
core::Iterator<core::num*>* :sync-for-iterator = initial.{core::Iterable::iterator}{core::Iterator<core::num*>*};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
final dynamic #t16 = :sync-for-iterator.{core::Iterator::current}{core::num*};
{
final core::int* #t17 = #t16 as{TypeError} core::int*;
#t15.{core::List::add}{Invariant}(#t17){(core::int*) →* void};
}
}
}
if(true)
#t15.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t15.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t15.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t15.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t15;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t18 = new col::_CompactLinkedHashSet::•<core::int*>();
{
core::Iterator<core::num*>* :sync-for-iterator = initial.{core::Iterable::iterator}{core::Iterator<core::num*>*};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
final dynamic #t19 = :sync-for-iterator.{core::Iterator::current}{core::num*};
{
final core::int* #t20 = #t19 as{TypeError} core::int*;
#t18.{core::Set::add}{Invariant}(#t20){(core::int*) →* core::bool*};
}
}
}
if(true)
#t18.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t18.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t18.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t18.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t18;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method foldInitialSpread4() void {
core::Iterable<core::int*>* initial = core::_GrowableList::_literal3<core::int*>(0, 1, 2);
core::List<core::int*>* list = block {
final core::List<core::int*>* #t21 = core::List::of<core::int*>(initial);
if(true)
#t21.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t21.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t21.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t21.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t21;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t22 = col::LinkedHashSet::of<core::int*>(initial);
if(true)
#t22.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t22.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t22.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t22.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t22;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method foldInitialSpread5() void {
core::List<core::int*>* initial = core::_GrowableList::_literal3<core::int*>(0, 1, 2);
core::List<core::int*>* list = block {
final core::List<core::int*>* #t23 = core::List::of<core::int*>(initial);
if(true)
#t23.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t23.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t23.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t23.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t23;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t24 = col::LinkedHashSet::of<core::int*>(initial);
if(true)
#t24.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t24.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t24.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t24.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t24;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method foldInitialSpread6() void {
core::List<core::int*>* initial = core::_GrowableList::_literal3<core::int*>(0, 1, 2);
core::List<core::int*>* list = block {
final core::List<core::int*>* #t25 = core::_GrowableList::•<core::int*>(0);
final core::Iterable<core::int*>* #t26 = initial;
if(!(#t26 == null))
#t25.{core::List::addAll}{Invariant}(#t26){(core::Iterable<core::int*>*) →* void};
if(true)
#t25.{core::List::add}{Invariant}(3){(core::int*) →* void};
#t25.{core::List::add}{Invariant}(4){(core::int*) →* void};
#t25.{core::List::add}{Invariant}(5){(core::int*) →* void};
#t25.{core::List::add}{Invariant}(6){(core::int*) →* void};
} =>#t25;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), list);
core::Set<core::int*>* set = block {
final core::Set<core::int*>* #t27 = new col::_CompactLinkedHashSet::•<core::int*>();
final core::Iterable<core::int*>* #t28 = initial;
if(!(#t28 == null))
#t27.{core::Set::addAll}{Invariant}(#t28){(core::Iterable<core::int*>*) →* void};
if(true)
#t27.{core::Set::add}{Invariant}(3){(core::int*) →* core::bool*};
#t27.{core::Set::add}{Invariant}(4){(core::int*) →* core::bool*};
#t27.{core::Set::add}{Invariant}(5){(core::int*) →* core::bool*};
#t27.{core::Set::add}{Invariant}(6){(core::int*) →* core::bool*};
} =>#t27;
self::expect(core::_GrowableList::generate<core::int*>(7, (core::int* i) core::int* => i), set.{core::Iterable::toList}(){({growable: core::bool*}) →* core::List<core::int*>*});
}
static method main() dynamic {
self::foldInitialElements();
self::foldInitialSpread1();
self::foldInitialSpread2();
self::foldInitialSpread3();
self::foldInitialSpread4();
self::foldInitialSpread5();
self::foldInitialSpread6();
}
static method expect(core::List<dynamic>* list1, core::List<dynamic>* list2) void {
if(!(list1.{core::List::length}{core::int*} =={core::num::==}{(core::Object*) →* core::bool*} list2.{core::List::length}{core::int*})) {
throw "Unexpected length. Expected ${list1.{core::List::length}{core::int*}}, actual ${list2.{core::List::length}{core::int*}}.";
}
for (core::int* i = 0; i.{core::num::<}(list1.{core::List::length}{core::int*}){(core::num*) →* core::bool*}; i = i.{core::num::+}(1){(core::num*) →* core::int*}) {
if(!(list1.{core::List::[]}(i){(core::int*) →* dynamic} =={core::Object::==}{(core::Object*) →* core::bool*} list2.{core::List::[]}(i){(core::int*) →* dynamic})) {
throw "Unexpected element at index ${i}. Expected ${list1.{core::List::[]}(i){(core::int*) →* dynamic}}, actual ${list2.{core::List::[]}(i){(core::int*) →* dynamic}}.";
}
}
}