blob: 00303556e3ae0734c3fcb7e0861485f4aaae4986 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
static method test1(dynamic x) dynamic
return block {
final core::List<core::int> #t1 = core::_GrowableList::•<core::int>(0);
hoisted core::int i;
hoisted core::int n;
{
final synthesized dynamic #0#0 = x as{TypeError,ForDynamic} core::List<core::int>;
synthesized dynamic #0#6;
synthesized core::bool #0#6#isSet = false;
synthesized dynamic #0#7;
synthesized core::bool #0#7#isSet = false;
if(!(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && ((#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t2 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::int && (let final core::int #t3 = i = (#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t4 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::int in true)) && ((#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool #t5 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) is core::int && (let final core::int #t6 = n = (#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool #t7 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) as{Unchecked} core::int in true))))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
final core::int #t8 = i;
final core::int #t9 = n;
for (core::int i = #t8, core::int n = #t9; i.{core::num::<}(n){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
#t1.{core::List::add}{Invariant}(i){(core::int) → void};
} =>#t1;
static method test2(dynamic x) dynamic
return block {
final core::Map<core::int, core::int> #t10 = <core::int, core::int>{};
#t10.{core::Map::[]=}{Invariant}(1.{core::int::unary-}(){() → core::int}, 1.{core::int::unary-}(){() → core::int}){(core::int, core::int) → void};
hoisted core::int i;
hoisted core::int n;
{
final synthesized dynamic #0#0 = x as{TypeError,ForDynamic} core::List<core::int>;
synthesized dynamic #0#6;
synthesized core::bool #0#6#isSet = false;
synthesized dynamic #0#7;
synthesized core::bool #0#7#isSet = false;
if(!(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && ((#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t11 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::int && (let final core::int #t12 = i = (#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t13 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::int in true)) && ((#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool #t14 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) is core::int && (let final core::int #t15 = n = (#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool #t16 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) as{Unchecked} core::int in true))))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
final core::int #t17 = i;
final core::int #t18 = n;
for (core::int i = #t17, core::int n = #t18; i.{core::num::<}(n){(core::num) → core::bool}; i = i.{core::num::+}(1){(core::num) → core::int})
#t10.{core::Map::[]=}{Invariant}(i, i){(core::int, core::int) → void};
#t10.{core::Map::[]=}{Invariant}(2.{core::int::unary-}(){() → core::int}, 2.{core::int::unary-}(){() → core::int}){(core::int, core::int) → void};
} =>#t10;
static method test3(dynamic x, dynamic another) dynamic
return block {
final core::Map<dynamic, dynamic> #t19 = <dynamic, dynamic>{};
#t19.{core::Map::[]=}{Invariant}(1.{core::int::unary-}(){() → core::int}, 1.{core::int::unary-}(){() → core::int}){(dynamic, dynamic) → void};
hoisted core::int i1;
hoisted dynamic n1;
{
final synthesized dynamic #0#0 = x as{TypeError,ForDynamic} core::List<core::int>;
synthesized dynamic #0#6;
synthesized core::bool #0#6#isSet = false;
if(!(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && ((#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t20 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::int && (let final core::int #t21 = i1 = (#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t22 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::int in true)) && (let final dynamic #t23 = n1 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic} in true)))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
final core::int #t24 = i1;
final dynamic #t25 = n1;
for (core::int i1 = #t24, dynamic n1 = #t25; i1.{core::num::<}(n1 as{TypeError,ForDynamic} core::num){(core::num) → core::bool}; i1 = i1.{core::num::+}(1){(core::num) → core::int}) {
hoisted core::int i2;
hoisted dynamic n2;
{
final synthesized dynamic #1#0 = x as{TypeError,ForDynamic} core::List<core::int>;
synthesized dynamic #1#8;
synthesized core::bool #1#8#isSet = false;
if(!(#1#0 is core::List<dynamic> && #1#0{core::List<dynamic>}.{core::List::length}{core::int}.{core::num::>=}(#C2){(core::num) → core::bool} && ((#1#8#isSet ?{dynamic} #1#8{dynamic} : let final core::bool #t26 = #1#8#isSet = true in #1#8 = #1#0{core::List<dynamic>}.{core::List::[]}(2){(core::int) → dynamic}) is core::int && (let final core::int #t27 = i2 = (#1#8#isSet ?{dynamic} #1#8{dynamic} : let final core::bool #t28 = #1#8#isSet = true in #1#8 = #1#0{core::List<dynamic>}.{core::List::[]}(2){(core::int) → dynamic}) as{Unchecked} core::int in true)) && (let final dynamic #t29 = n2 = #1#0{core::List<dynamic>}.{core::List::[]}(3){(core::int) → dynamic} in true)))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
final core::int #t30 = i2;
final dynamic #t31 = n2;
for (core::int i2 = #t30, dynamic n2 = #t31; i2.{core::num::<}(n2 as{TypeError,ForDynamic} core::num){(core::num) → core::bool}; i2 = i2.{core::num::+}(1){(core::num) → core::int})
#t19.{core::Map::addAll}{Invariant}(another as{TypeError,ForDynamic} core::Map<dynamic, dynamic>){(core::Map<dynamic, dynamic>) → void};
}
#t19.{core::Map::[]=}{Invariant}(2.{core::int::unary-}(){() → core::int}, 2.{core::int::unary-}(){() → core::int}){(dynamic, dynamic) → void};
} =>#t19;
static method main() dynamic {
self::expectEquals(self::listToString(self::test1(core::_GrowableList::_literal2<core::int>(0, 3)) as{TypeError,ForDynamic} core::List<dynamic>), self::listToString(core::_GrowableList::_literal3<dynamic>(0, 1, 2)));
self::expectEquals(self::listToString(self::test1(core::_GrowableList::_literal2<core::int>(0, 0)) as{TypeError,ForDynamic} core::List<dynamic>), self::listToString(core::_GrowableList::•<dynamic>(0)));
self::expectThrows(() void => self::test1(<dynamic, dynamic>{}));
self::expectEquals(self::mapToString(self::test2(core::_GrowableList::_literal2<core::int>(0, 3)) as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{2.{core::int::unary-}(){() core::int}: 2.{core::int::unary-}(){() core::int}, 1.{core::int::unary-}(){() core::int}: 1.{core::int::unary-}(){() core::int}, 0: 0, 1: 1, 2: 2}));
self::expectEquals(self::mapToString(self::test2(core::_GrowableList::_literal2<core::int>(0, 0)) as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{2.{core::int::unary-}(){() core::int}: 2.{core::int::unary-}(){() core::int}, 1.{core::int::unary-}(){() core::int}: 1.{core::int::unary-}(){() core::int}}));
self::expectThrows(() void => self::test1(core::_GrowableList::•<dynamic>(0)));
self::expectEquals(self::mapToString(self::test3(core::_GrowableList::_literal4<core::int>(0, 0, 0, 0), <core::int, core::int>{0: 0}) as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{1.{core::int::unary-}(){() core::int}: 1.{core::int::unary-}(){() core::int}, 2.{core::int::unary-}(){() core::int}: 2.{core::int::unary-}(){() core::int}}));
self::expectEquals(self::mapToString(self::test3(core::_GrowableList::_literal4<core::int>(0, 1, 0, 1), <core::int, core::int>{0: 0}) as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{1.{core::int::unary-}(){() core::int}: 1.{core::int::unary-}(){() core::int}, 2.{core::int::unary-}(){() core::int}: 2.{core::int::unary-}(){() core::int}, 0: 0}));
self::expectThrows(() void => self::test3(core::_GrowableList::•<dynamic>(0), <dynamic, dynamic>{}));
}
static method expectEquals(dynamic x, dynamic y) dynamic {
if(!(x =={core::Object::==}{(core::Object) core::bool} y)) {
throw "Expected '${x}' to be equal to '${y}'.";
}
}
static method listToString(core::List<dynamic> list) dynamic
return "[${list.{core::Iterable::map}<core::String>((dynamic e) → core::String => "${e}"){((dynamic) → core::String) → core::Iterable<core::String>}.{core::Iterable::join}(","){([core::String]) → core::String}}]";
static method expectThrows(() void f) dynamic {
core::bool hasThrown = true;
try {
f(){() void};
hasThrown = false;
}
on core::Object catch(final core::Object e) {
}
if(!hasThrown) {
throw "Expected the function to throw.";
}
}
static method mapToString(core::Map<dynamic, dynamic> map) dynamic {
core::List<core::String> entryStrings = block {
final core::List<core::String> #t32 = core::_GrowableList::•<core::String>(0);
{
synthesized core::Iterator<core::MapEntry<dynamic, dynamic>> :sync-for-iterator = map.{core::Map::entries}{core::Iterable<core::MapEntry<dynamic, dynamic>>}.{core::Iterable::iterator}{core::Iterator<core::MapEntry<dynamic, dynamic>>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
core::MapEntry<dynamic, dynamic> entry = :sync-for-iterator.{core::Iterator::current}{core::MapEntry<dynamic, dynamic>};
#t32.{core::List::add}{Invariant}("${entry.{core::MapEntry::key}{dynamic}}:${entry.{core::MapEntry::value}{dynamic}}"){(core::String) → void};
}
}
} =>#t32;
entryStrings.{core::List::sort}(){([(core::String, core::String) →? core::int]) void};
return "[${entryStrings.{core::Iterable::join}(","){([core::String]) → core::String}}]";
}
constants {
#C1 = 2
#C2 = 4
}
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:8:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:8:7 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:10:3 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:10:7 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:14:3 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:14:7 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:18:3 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:18:7 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:34:18 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:34:22 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:34:26 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:34:30 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:38:18 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:38:22 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:38:26 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:38:30 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:44:18 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:44:22 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:44:26 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:44:30 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:48:18 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:48:22 -> IntConstant(-1)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:48:26 -> IntConstant(-2)
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_c_style_pattern_for_in_collections.dart:48:30 -> IntConstant(-2)
Extra constant evaluation: evaluated: 380, effectively constant: 24