blob: 71bfe6d7c4fd3058b037af369f467bd67c09b2a5 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
import "dart:async";
typedef FunctionType = () void;
typedef GenericFunctionType<invariant T extends core::Object? = dynamic> = (T%) T%;
static method test<T extends core::Object? = dynamic>(dynamic o) dynamic {
{
final synthesized dynamic #0#0 = o;
{
hoisted core::int hashCode;
if(#0#0 is () → void) {
hashCode = #0#0{() → void}.{core::Object::hashCode}{core::int};
{
core::print(hashCode);
return 1;
}
}
}
}
{
final synthesized dynamic #1#0 = o;
{
hoisted core::int hashCode;
if(#1#0 is (core::int) → core::int) {
hashCode = #1#0{(core::int) → core::int}.{core::Object::hashCode}{core::int};
{
core::print(hashCode);
return 2;
}
}
}
}
{
final synthesized dynamic #2#0 = o;
{
hoisted core::int hashCode;
if(#2#0 is (core::String) → core::String) {
hashCode = #2#0{(core::String) → core::String}.{core::Object::hashCode}{core::int};
{
core::print(hashCode);
return 3;
}
}
}
}
{
final synthesized dynamic #3#0 = o;
{
hoisted core::int hashCode;
if(#3#0 is (self::test::T%) → self::test::T%) {
hashCode = #3#0{(self::test::T%) → self::test::T%}.{core::Object::hashCode}{core::int};
{
core::print(hashCode);
return 4;
}
}
}
}
{
final synthesized dynamic #4#0 = o;
{
hoisted core::int hashCode;
if(#4#0 is (dynamic) → dynamic) {
hashCode = #4#0{(dynamic) → dynamic}.{core::Object::hashCode}{core::int};
{
core::print(hashCode);
return 5;
}
}
}
}
{
final synthesized dynamic #5#0 = o;
{
hoisted core::int hashCode;
if(#5#0 is Null) {
hashCode = #5#0{Null}.{core::Object::hashCode}{<object>}.{core::int};
{
core::print(hashCode);
return 6;
}
}
}
}
{
final synthesized dynamic #6#0 = o;
{
hoisted core::int hashCode;
if(#6#0 is FutureOr<core::int>) {
hashCode = #6#0{FutureOr<core::int>}.{core::Object::hashCode}{<object>}.{core::int};
{
core::print(hashCode);
return 7;
}
}
}
}
{
final synthesized dynamic #7#0 = o;
{
hoisted dynamic hashCode;
if(#7#0 is dynamic) {
hashCode = #7#0.{core::Object::hashCode}{<object>}.{core::int};
{
core::print(hashCode);
return 0;
}
}
}
}
return 1.{core::int::unary-}(){() core::int};
}
static method function() void {}
static method intFunction(core::int i) core::int
return i;
static method stringFunction(core::String s) core::String
return s;
static method boolFunction(core::bool b) core::bool
return b;
static method dynamicFunction(dynamic d) dynamic
return d;
static method multiArgFunction(core::int i, core::String s) void {}
static method main() dynamic {
self::expect(1, self::test<dynamic>(#C1));
self::expect(2, self::test<dynamic>(#C2));
self::expect(3, self::test<dynamic>(#C3));
self::expect(4, self::test<core::bool>(#C4));
self::expect(0, self::test<dynamic>(#C4));
self::expect(0, self::test<core::num>(#C4));
self::expect(4, self::test<dynamic>(#C5));
self::expect(4, self::test<dynamic>(#C5));
self::expect(5, self::test<core::bool>(#C5));
self::expect(0, self::test<dynamic>(#C6));
self::expect(6, self::test<dynamic>(null));
self::expect(7, self::test<dynamic>(0));
self::expect(7, self::test<dynamic>(asy::Future::value<core::int>(0)));
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(!(expected =={core::Object::==}{(core::Object) core::bool} actual)) {
throw "Expected ${expected}, actual ${actual}";
}
}
constants {
#C1 = static-tearoff self::function
#C2 = static-tearoff self::intFunction
#C3 = static-tearoff self::stringFunction
#C4 = static-tearoff self::boolFunction
#C5 = static-tearoff self::dynamicFunction
#C6 = static-tearoff self::multiArgFunction
}
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///non_interface_type_object_pattern.dart:43:10 -> IntConstant(-1)
Extra constant evaluation: evaluated: 104, effectively constant: 1