blob: 05ee3e1f8dfcd307c9e75655a8c4341117a22aa6 [file] [log] [blame]
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/*element: main:
static=[
testAbstractClassWithField(0),
testEnum(0),
testForwardingConstructor(0),
testForwardingConstructorGeneric(0),
testForwardingConstructorTyped(0),
testGenericMixinInstantiation(0),
testGenericNamedMixinInstantiation(0),
testInstanceGenericMethod(0),
testMixinInstantiation(0),
testNamedMixinInstantiation(0),
testStaticGenericMethod(0),
testSuperCall(0),
testSuperClosurization(0),
testSuperFieldSet(0),
testSuperGet(0),
testSuperSetterSet(0)]
*/
main() {
testSuperCall();
testSuperGet();
testSuperFieldSet();
testSuperSetterSet();
testSuperClosurization();
testForwardingConstructor();
testForwardingConstructorTyped();
testForwardingConstructorGeneric();
testEnum();
testStaticGenericMethod();
testInstanceGenericMethod();
testAbstractClassWithField();
testMixinInstantiation();
testNamedMixinInstantiation();
testGenericMixinInstantiation();
testGenericNamedMixinInstantiation();
}
/*element: Super1.:static=[Object.(0)]*/
class Super1 {
/*element: Super1.foo:*/
foo() {}
}
class Sub1 extends Super1 {
/*element: Sub1.:static=[Super1.(0),Super1.foo(0)]*/
Sub1() {
super.foo();
}
}
/*element: testSuperCall:static=[Sub1.(0)]*/
testSuperCall() => new Sub1();
/*element: Super2.:static=[Object.(0)]*/
class Super2 {
/*element: Super2.foo:type=[inst:JSNull]*/
var foo;
}
class Sub2 extends Super2 {
/*element: Sub2.:static=[Super2.(0),Super2.foo]*/
Sub2() {
super.foo;
}
}
/*element: testSuperGet:static=[Sub2.(0)]*/
testSuperGet() => new Sub2();
/*element: Super3.:static=[Object.(0)]*/
class Super3 {
/*element: Super3.foo:type=[inst:JSNull]*/
var foo;
}
class Sub3 extends Super3 {
/*element: Sub3.:static=[Super3.(0),set:Super3.foo],type=[inst:JSBool]*/
Sub3() {
super.foo = true;
}
}
/*element: testSuperFieldSet:static=[Sub3.(0)]*/
testSuperFieldSet() => new Sub3();
/*element: Super4.:static=[Object.(0)]*/
class Super4 {
/*element: Super4.foo=:*/
set foo(_) {}
}
class Sub4 extends Super4 {
/*element: Sub4.:static=[Super4.(0),set:Super4.foo],type=[inst:JSBool]*/
Sub4() {
super.foo = true;
}
}
/*element: testSuperSetterSet:static=[Sub4.(0)]*/
testSuperSetterSet() => new Sub4();
/*element: Super5.:static=[Object.(0)]*/
class Super5 {
/*element: Super5.foo:*/
foo() {}
}
/*element: Sub5.:static=[Super5.(0),Super5.foo]*/
class Sub5 extends Super5 {
Sub5() {
super.foo;
}
}
/*element: testSuperClosurization:static=[Sub5.(0)]*/
testSuperClosurization() => new Sub5();
class EmptyMixin {}
class ForwardingConstructorSuperClass {
/*element: ForwardingConstructorSuperClass.:static=[Object.(0)]*/
ForwardingConstructorSuperClass(arg);
}
class ForwardingConstructorClass = ForwardingConstructorSuperClass
with EmptyMixin;
/*element: testForwardingConstructor:
static=[ForwardingConstructorClass.(1)],
type=[inst:JSNull]
*/
testForwardingConstructor() => new ForwardingConstructorClass(null);
class ForwardingConstructorTypedSuperClass {
/*element: ForwardingConstructorTypedSuperClass.:
static=[Object.(0)],
type=[inst:JSBool,param:int]
*/
ForwardingConstructorTypedSuperClass(int arg);
}
class ForwardingConstructorTypedClass = ForwardingConstructorTypedSuperClass
with EmptyMixin;
/*element: testForwardingConstructorTyped:
static=[ForwardingConstructorTypedClass.(1)],
type=[inst:JSNull]
*/
testForwardingConstructorTyped() => new ForwardingConstructorTypedClass(null);
class ForwardingConstructorGenericSuperClass<T> {
/*element: ForwardingConstructorGenericSuperClass.:
static=[
Object.(0),
checkSubtype(4),
checkSubtypeOfRuntimeType(2),
getRuntimeTypeArgument(3),
getRuntimeTypeArgumentIntercepted(4),
getRuntimeTypeInfo(1),
getTypeArgumentByIndex(2),
setRuntimeTypeInfo(2)],
type=[
inst:JSArray<dynamic>,
inst:JSBool,
inst:JSExtendableArray<dynamic>,
inst:JSFixedArray<dynamic>,
inst:JSMutableArray<dynamic>,
inst:JSUnmodifiableArray<dynamic>,
param:ForwardingConstructorGenericSuperClass.T]
*/
ForwardingConstructorGenericSuperClass(T arg);
}
class ForwardingConstructorGenericClass<
S> = ForwardingConstructorGenericSuperClass<S> with EmptyMixin;
/*element: testForwardingConstructorGeneric:
static=[
ForwardingConstructorGenericClass.(1),
assertIsSubtype(5),
throwTypeError(1)],
type=[inst:JSNull]
*/
testForwardingConstructorGeneric() {
new ForwardingConstructorGenericClass<int>(null);
}
enum Enum {
/*strong.element: Enum.A:static=[Enum.(2)],
type=[
inst:JSBool,
inst:JSDouble,
inst:JSInt,
inst:JSNumber,
inst:JSPositiveInt,
inst:JSString,
inst:JSUInt31,
inst:JSUInt32,
param:Enum]
*/
A
}
/*strong.element: testEnum:static=[Enum.A]*/
/*strongConst.element: testEnum:constant=[Enum(_name="Enum.A",index=0)]*/
testEnum() => Enum.A;
/*element: staticGenericMethod:
static=[
checkSubtype(4),
checkSubtypeOfRuntimeType(2),
getRuntimeTypeArgument(3),
getRuntimeTypeArgumentIntercepted(4),
getRuntimeTypeInfo(1),
getTypeArgumentByIndex(2),
setRuntimeTypeInfo(2)],
type=[
inst:JSArray<dynamic>,
inst:JSBool,
inst:JSExtendableArray<dynamic>,
inst:JSFixedArray<dynamic>,
inst:JSMutableArray<dynamic>,
inst:JSUnmodifiableArray<dynamic>,
inst:List<staticGenericMethod.T>,
param:Object,
param:staticGenericMethod.T]
*/
List<T> staticGenericMethod<T>(T arg) => [arg];
/*element: testStaticGenericMethod:
static=[staticGenericMethod<bool>(1)],
type=[inst:JSBool]
*/
testStaticGenericMethod() {
staticGenericMethod<bool>(true);
}
/*element: testInstanceGenericMethod:
dynamic=[exact:GenericClass.genericMethod<bool>(1)],
static=[
GenericClass.generative(0),
assertIsSubtype(5),
throwTypeError(1)],
type=[inst:JSBool]
*/
testInstanceGenericMethod() {
new GenericClass<int, String>.generative().genericMethod<bool>(false);
}
abstract class AbstractClass {
// ignore: UNUSED_FIELD
final _field;
/*element: AbstractClass.:type=[inst:JSNull]*/
factory AbstractClass() => null;
}
/*element: testAbstractClassWithField:static=[AbstractClass.(0)]*/
testAbstractClassWithField() => new AbstractClass();
/*element: testMixinInstantiation:static=[Sub.(0)]*/
testMixinInstantiation() => new Sub();
/*element: testNamedMixinInstantiation:static=[NamedMixin.(0)]*/
testNamedMixinInstantiation() => new NamedMixin();
/*element: testGenericMixinInstantiation:
static=[
GenericSub.(0),
assertIsSubtype(5),
throwTypeError(1)]
*/
testGenericMixinInstantiation() => new GenericSub<int, String>();
/*element: testGenericNamedMixinInstantiation:
static=[
GenericNamedMixin.(0),
assertIsSubtype(5),
throwTypeError(1)]
*/
testGenericNamedMixinInstantiation() => new GenericNamedMixin<int, String>();
class Class {
/*element: GenericClass.generative:static=[Object.(0)]*/
const Class.generative();
}
class GenericClass<X, Y> {
const GenericClass.generative();
/*element: GenericClass.genericMethod:
static=[
checkSubtype(4),
checkSubtypeOfRuntimeType(2),
getRuntimeTypeArgument(3),
getRuntimeTypeArgumentIntercepted(4),
getRuntimeTypeInfo(1),
getTypeArgumentByIndex(2),
setRuntimeTypeInfo(2)],
type=[
inst:JSArray<dynamic>,
inst:JSBool,
inst:JSExtendableArray<dynamic>,
inst:JSFixedArray<dynamic>,
inst:JSMutableArray<dynamic>,
inst:JSNull,
inst:JSUnmodifiableArray<dynamic>,
inst:Map<GenericClass.X,genericMethod.T>,
param:Object,
param:genericMethod.T]
*/
Map<X, T> genericMethod<T>(T arg) => {null: arg};
}
/*element: Super.:static=[Object.(0)]*/
class Super {}
class Mixin1 {}
class Mixin2 {}
/*element: Sub.:static=[_Sub&Super&Mixin1&Mixin2.(0)]*/
class Sub extends Super with Mixin1, Mixin2 {}
class NamedMixin = Super with Mixin1, Mixin2;
/*element: GenericSuper.:static=[Object.(0)]*/
class GenericSuper<X1, Y1> {}
class GenericMixin1<X2, Y2> {}
class GenericMixin2<X3, Y3> {}
/*element: GenericSub.:
static=[_GenericSub&GenericSuper&GenericMixin1&GenericMixin2.(0)]
*/
class GenericSub<X4, Y4> extends GenericSuper<X4, Y4>
with GenericMixin1<X4, Y4>, GenericMixin2<X4, Y4> {}
class GenericNamedMixin<X5, Y5> = GenericSuper<X5, Y5>
with GenericMixin1<X5, Y5>, GenericMixin2<X5, Y5>;