library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;

import "org-dartlang-testcase:///issue46719.dart" as self;

class A<T extends core::Object? = dynamic> extends core::Object {
  constructor •() → self::A<self::A::T%>
    : super core::Object::•()
    ;
  constructor named() → self::A<self::A::T%>
    : super core::Object::•()
    ;
  method m<X extends core::Object? = dynamic>(self::A::m::X% x) → core::List<self::A::m::X%>
    return core::_GrowableList::_literal1<self::A::m::X%>(x);
  static method n<X extends core::Object? = dynamic>(self::A::n::X% x) → core::List<self::A::n::X%>
    return core::_GrowableList::_literal1<self::A::n::X%>(x);
}
extension FunctionApplier on core::Function {
  method applyAndPrint = self::FunctionApplier|applyAndPrint;
  tearoff applyAndPrint = self::FunctionApplier|get#applyAndPrint;
}
static method m<X extends core::Object? = dynamic>(self::m::X% x) → core::List<self::m::X%>
  return core::_GrowableList::_literal1<self::m::X%>(x);
static method FunctionApplier|applyAndPrint(lowered final core::Function #this, core::List<core::Object?> positionalArguments) → void
  return core::print(core::Function::apply(#this, positionalArguments, #C2));
static method FunctionApplier|get#applyAndPrint(lowered final core::Function #this) → (core::List<core::Object?>) → void
  return (core::List<core::Object?> positionalArguments) → void => self::FunctionApplier|applyAndPrint(#this, positionalArguments);
static method test() → dynamic {
  (#C4).{core::Object::toString}(){() → core::String};
}
static method main() → void {
  self::A<dynamic> a = new self::A::•<dynamic>();
  self::FunctionApplier|applyAndPrint(a.{self::A::m}{<X extends core::Object? = dynamic>(X%) → core::List<X%>}<core::int>, core::_GrowableList::_literal1<core::Object?>(2));
  self::FunctionApplier|applyAndPrint(a.{self::A::m}{<X extends core::Object? = dynamic>(X%) → core::List<X%>}<core::String>, core::_GrowableList::_literal1<core::Object?>("three"));
  self::FunctionApplier|applyAndPrint(#C6, core::_GrowableList::_literal1<core::Object?>(2));
  self::FunctionApplier|applyAndPrint(#C7, core::_GrowableList::_literal1<core::Object?>("three"));
  self::FunctionApplier|applyAndPrint(#C9, core::_GrowableList::_literal1<core::Object?>(2));
  self::FunctionApplier|applyAndPrint(#C10, core::_GrowableList::_literal1<core::Object?>("three"));
  self::FunctionApplier|applyAndPrint(#C6, core::_GrowableList::_literal1<core::Object?>(2));
  self::FunctionApplier|applyAndPrint(#C7, core::_GrowableList::_literal1<core::Object?>("three"));
  (#C3).{core::Object::toString}(){() → core::String};
  (#C4).{core::Object::toString}(){() → core::String};
}

constants  {
  #C1 = <dynamic>[]
  #C2 = core::_ImmutableMap<core::Symbol, dynamic> {_kvPairs:#C1}
  #C3 = constructor-tearoff self::A::named
  #C4 = instantiation self::A::named <core::int>
  #C5 = static-tearoff self::A::n
  #C6 = instantiation self::A::n <core::int>
  #C7 = instantiation self::A::n <core::String>
  #C8 = static-tearoff self::m
  #C9 = instantiation self::m <core::int>
  #C10 = instantiation self::m <core::String>
}
