blob: e189577ea7a089cbc872e9b4e15efe9c9b21b833 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
import "dart:collection";
class MyMap<K extends core::Object? = dynamic, V extends core::Object? = dynamic> extends col::MapBase<self::MyMap::K%, self::MyMap::V%> {
covariant-by-class field core::Map<self::MyMap::K%, self::MyMap::V%> _inner;
field core::String log = "";
constructor •(core::Map<self::MyMap::K%, self::MyMap::V%> _inner) self::MyMap<self::MyMap::K%, self::MyMap::V%>
: self::MyMap::_inner = _inner, super col::MapBase::•()
;
@#C1
operator [](core::Object? key) self::MyMap::V? {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("[${key}];"){(core::String) core::String};
return this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::[]}(key){(core::Object?) self::MyMap::V?};
}
@#C1
operator []=(covariant-by-class self::MyMap::K% key, covariant-by-class self::MyMap::V% value) void {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("[${key}]=${value};"){(core::String) core::String};
this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::[]=}(key, value){(self::MyMap::K%, self::MyMap::V%) void};
}
@#C1
method clear() void {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("clear();"){(core::String) core::String};
this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::clear}(){() void};
}
@#C1
get keys() core::Iterable<self::MyMap::K%> {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("keys;"){(core::String) core::String};
return this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::keys}{core::Iterable<self::MyMap::K%>};
}
@#C1
method remove(core::Object? key) self::MyMap::V? {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("remove(${key});"){(core::String) core::String};
return this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::remove}(key){(core::Object?) self::MyMap::V?};
}
@#C1
get length() core::int {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("length;"){(core::String) core::String};
return this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::length}{core::int};
}
@#C1
method containsKey(core::Object? key) core::bool {
this.{self::MyMap::log} = this.{self::MyMap::log}{core::String}.{core::String::+}("containsKey(${key});"){(core::String) core::String};
return this.{self::MyMap::_inner}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::containsKey}(key){(core::Object?) core::bool};
}
method clearLog() void {
this.{self::MyMap::log} = "";
}
}
static field core::String unsoundResult = #C2;
static field core::String soundResult = #C3;
static get hasUnsoundNullSafety() core::bool
return #C4 is core::List<core::Object>;
static method test1(core::Object o) core::String {
#L1:
{
final synthesized core::Object #0#0 = o;
synthesized core::int? #0#4;
synthesized core::bool #0#4#isSet = false;
synthesized core::bool #0#3;
synthesized core::bool #0#3#isSet = false;
synthesized core::bool #0#6;
synthesized core::bool #0#6#isSet = false;
synthesized core::int? #0#9;
synthesized core::bool #0#9#isSet = false;
synthesized core::bool #0#8;
synthesized core::bool #0#8#isSet = false;
{
if(#0#0 is core::Map<core::String, core::int> && (!((#0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t1 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?}) == null) || null is core::int && (#0#3#isSet ?{core::bool} #0#3{core::bool} : let final core::bool #t2 = #0#3#isSet = true in #0#3 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C5){(core::Object?) → core::bool})) && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t3 = #0#6#isSet = true in #0#6 = #C6 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t4 = #0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t5 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?} in #t4 == null ?{core::int} #t4 as{Unchecked} core::int : #t4{core::int})) && (!((#0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t6 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?}) == null) || null is core::int && (#0#8#isSet ?{core::bool} #0#8{core::bool} : let final core::bool #t7 = #0#8#isSet = true in #0#8 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C7){(core::Object?) → core::bool})) && #C8 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t8 = #0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t9 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?} in #t8 == null ?{core::int} #t8 as{Unchecked} core::int : #t8{core::int})) {
{
return "match-2";
}
}
}
{
if(#0#0 is core::Map<core::String, core::int> && (!((#0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t10 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?}) == null) || null is core::int && (#0#3#isSet ?{core::bool} #0#3{core::bool} : let final core::bool #t11 = #0#3#isSet = true in #0#3 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C5){(core::Object?) → core::bool})) && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t12 = #0#6#isSet = true in #0#6 = #C6 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t13 = #0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t14 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?} in #t13 == null ?{core::int} #t13 as{Unchecked} core::int : #t13{core::int})) && (!((#0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t15 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?}) == null) || null is core::int && (#0#8#isSet ?{core::bool} #0#8{core::bool} : let final core::bool #t16 = #0#8#isSet = true in #0#8 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C7){(core::Object?) → core::bool})) && #C9 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t17 = #0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t18 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?} in #t17 == null ?{core::int} #t17 as{Unchecked} core::int : #t17{core::int})) {
{
return "match-3";
}
}
}
{
{
{
return "no match";
}
}
}
}
}
static method test2(core::Object o) core::String
return block {
core::String #t19;
final synthesized core::Object #0#0 = o;
synthesized core::int? #0#4;
synthesized core::bool #0#4#isSet = false;
synthesized core::bool #0#3;
synthesized core::bool #0#3#isSet = false;
synthesized core::bool #0#6;
synthesized core::bool #0#6#isSet = false;
synthesized core::int? #0#9;
synthesized core::bool #0#9#isSet = false;
synthesized core::bool #0#8;
synthesized core::bool #0#8#isSet = false;
#L2:
{
{
if(#0#0 is core::Map<core::String, core::int> && (!((#0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t20 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?}) == null) || null is core::int && (#0#3#isSet ?{core::bool} #0#3{core::bool} : let final core::bool #t21 = #0#3#isSet = true in #0#3 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C5){(core::Object?) → core::bool})) && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t22 = #0#6#isSet = true in #0#6 = #C6 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t23 = #0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t24 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?} in #t23 == null ?{core::int} #t23 as{Unchecked} core::int : #t23{core::int})) && (!((#0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t25 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?}) == null) || null is core::int && (#0#8#isSet ?{core::bool} #0#8{core::bool} : let final core::bool #t26 = #0#8#isSet = true in #0#8 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C7){(core::Object?) → core::bool})) && #C8 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t27 = #0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t28 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?} in #t27 == null ?{core::int} #t27 as{Unchecked} core::int : #t27{core::int})) {
#t19 = "match-2";
break #L2;
}
}
{
if(#0#0 is core::Map<core::String, core::int> && (!((#0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t29 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?}) == null) || null is core::int && (#0#3#isSet ?{core::bool} #0#3{core::bool} : let final core::bool #t30 = #0#3#isSet = true in #0#3 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C5){(core::Object?) → core::bool})) && (#0#6#isSet ?{core::bool} #0#6{core::bool} : let final core::bool #t31 = #0#6#isSet = true in #0#6 = #C6 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t32 = #0#4#isSet ?{core::int?} #0#4{core::int?} : let final core::bool #t33 = #0#4#isSet = true in #0#4 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C5){(core::Object?) → core::int?} in #t32 == null ?{core::int} #t32 as{Unchecked} core::int : #t32{core::int})) && (!((#0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t34 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?}) == null) || null is core::int && (#0#8#isSet ?{core::bool} #0#8{core::bool} : let final core::bool #t35 = #0#8#isSet = true in #0#8 = #0#0{core::Map<core::String, core::int>}.{core::Map::containsKey}(#C7){(core::Object?) → core::bool})) && #C9 =={core::num::==}{(core::Object) → core::bool} (let core::int? #t36 = #0#9#isSet ?{core::int?} #0#9{core::int?} : let final core::bool #t37 = #0#9#isSet = true in #0#9 = #0#0{core::Map<core::String, core::int>}.{core::Map::[]}(#C7){(core::Object?) → core::int?} in #t36 == null ?{core::int} #t36 as{Unchecked} core::int : #t36{core::int})) {
#t19 = "match-3";
break #L2;
}
}
{
if(true) {
#t19 = "no match";
break #L2;
}
}
}
} =>#t19;
static method main() dynamic {
final self::MyMap<core::String, core::int> map = new self::MyMap::•<core::String, core::int>(<core::String, core::int>{"key1": 1, "key2": 2});
self::expect("match-3", self::test1(map));
self::expect(self::hasUnsoundNullSafety ?{core::String} self::unsoundResult : self::soundResult, map.{self::MyMap::log}{core::String});
map.{self::MyMap::clearLog}(){() void};
self::expect("match-3", self::test2(map));
self::expect(self::hasUnsoundNullSafety ?{core::String} self::unsoundResult : self::soundResult, map.{self::MyMap::log}{core::String});
map.{self::MyMap::clearLog}(){() void};
hoisted has-declared-initializer core::int x1;
hoisted has-declared-initializer core::int x2;
{
final synthesized self::MyMap<core::String, core::int> #0#0 = map;
synthesized core::int? #0#3;
synthesized core::bool #0#3#isSet = false;
synthesized core::int? #0#6;
synthesized core::bool #0#6#isSet = false;
if(!((!((#0#3#isSet ?{core::int?} #0#3{core::int?} : let final core::bool #t38 = #0#3#isSet = true in #0#3 = #0#0.{self::MyMap::[]}(#C5){(core::Object?) → core::int?}) == null) || null is core::int && #0#0.{self::MyMap::containsKey}(#C5){(core::Object?) → core::bool}) && (let final core::int #t39 = x1 = let core::int? #t40 = #0#3#isSet ?{core::int?} #0#3{core::int?} : let final core::bool #t41 = #0#3#isSet = true in #0#3 = #0#0.{self::MyMap::[]}(#C5){(core::Object?) → core::int?} in #t40 == null ?{core::int} #t40 as{Unchecked} core::int : #t40{core::int} in true) && (!((#0#6#isSet ?{core::int?} #0#6{core::int?} : let final core::bool #t42 = #0#6#isSet = true in #0#6 = #0#0.{self::MyMap::[]}(#C7){(core::Object?) → core::int?}) == null) || null is core::int && #0#0.{self::MyMap::containsKey}(#C7){(core::Object?) → core::bool}) && (let final core::int #t43 = x2 = let core::int? #t44 = #0#6#isSet ?{core::int?} #0#6{core::int?} : let final core::bool #t45 = #0#6#isSet = true in #0#6 = #0#0.{self::MyMap::[]}(#C7){(core::Object?) → core::int?} in #t44 == null ?{core::int} #t44 as{Unchecked} core::int : #t44{core::int} in true)))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
self::expect(self::hasUnsoundNullSafety ?{core::String} self::unsoundResult : self::soundResult, map.{self::MyMap::log}{core::String});
map.{self::MyMap::clearLog}(){() void};
final hoisted has-declared-initializer core::int y1;
final hoisted has-declared-initializer core::int y2;
{
final synthesized self::MyMap<core::String, core::int> #1#0 = map;
synthesized core::int? #1#3;
synthesized core::bool #1#3#isSet = false;
synthesized core::int? #1#6;
synthesized core::bool #1#6#isSet = false;
if(!((!((#1#3#isSet ?{core::int?} #1#3{core::int?} : let final core::bool #t46 = #1#3#isSet = true in #1#3 = #1#0.{self::MyMap::[]}(#C5){(core::Object?) → core::int?}) == null) || null is core::int && #1#0.{self::MyMap::containsKey}(#C5){(core::Object?) → core::bool}) && (let final core::int #t47 = y1 = let core::int? #t48 = #1#3#isSet ?{core::int?} #1#3{core::int?} : let final core::bool #t49 = #1#3#isSet = true in #1#3 = #1#0.{self::MyMap::[]}(#C5){(core::Object?) → core::int?} in #t48 == null ?{core::int} #t48 as{Unchecked} core::int : #t48{core::int} in true) && (!((#1#6#isSet ?{core::int?} #1#6{core::int?} : let final core::bool #t50 = #1#6#isSet = true in #1#6 = #1#0.{self::MyMap::[]}(#C7){(core::Object?) → core::int?}) == null) || null is core::int && #1#0.{self::MyMap::containsKey}(#C7){(core::Object?) → core::bool}) && (let final core::int #t51 = y2 = let core::int? #t52 = #1#6#isSet ?{core::int?} #1#6{core::int?} : let final core::bool #t53 = #1#6#isSet = true in #1#6 = #1#0.{self::MyMap::[]}(#C7){(core::Object?) → core::int?} in #t52 == null ?{core::int} #t52 as{Unchecked} core::int : #t52{core::int} in true)))
throw{for-error-handling} new core::StateError::•("Pattern matching error");
}
self::expect(self::hasUnsoundNullSafety ?{core::String} self::unsoundResult : self::soundResult, map.{self::MyMap::log}{core::String});
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(!(expected =={core::Object::==}{(core::Object) core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
constants {
#C1 = core::_Override {}
#C2 = "containsKey(key1);[key1];containsKey(key2);[key2];"
#C3 = "[key1];[key2];"
#C4 = <Null>[]
#C5 = "key1"
#C6 = 1
#C7 = "key2"
#C8 = 3
#C9 = 2
}
Extra constant evaluation status:
Evaluated: IsExpression @ org-dartlang-testcase:///map_lookup.dart:9:49 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:74:30 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:74:41 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:76:30 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:76:41 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:84:27 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:84:38 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:85:27 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:85:38 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:99:14 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:99:26 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:103:16 -> BoolConstant(false)
Evaluated: LogicalExpression @ org-dartlang-testcase:///map_lookup.dart:103:28 -> BoolConstant(false)
Extra constant evaluation: evaluated: 533, effectively constant: 13