mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:44:27 +00:00
Fix (super)mixins issues
Change-Id: I5892f2fec7fc7b7449fb600c74e4d105dc0f4bbe Reviewed-on: https://dart-review.googlesource.com/77180 Commit-Queue: Johnni Winther <johnniwinther@google.com> Auto-Submit: Johnni Winther <johnniwinther@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
da3e844cac
commit
41a875f420
39 changed files with 275 additions and 162 deletions
|
@ -1677,8 +1677,8 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
|
|||
// are calling does not expose this.
|
||||
_markThisAsExposed();
|
||||
|
||||
MemberEntity member = _elementMap.getSuperMember(
|
||||
_analyzedMember, node.name, node.interfaceTarget);
|
||||
MemberEntity member =
|
||||
_elementMap.getSuperMember(_analyzedMember, node.name);
|
||||
AbstractValue mask = _memberData.typeOfSend(node);
|
||||
Selector selector = new Selector.getter(_elementMap.getName(node.name));
|
||||
if (member == null) {
|
||||
|
@ -1700,9 +1700,8 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
|
|||
_markThisAsExposed();
|
||||
|
||||
TypeInformation rhsType = visit(node.value);
|
||||
MemberEntity member = _elementMap.getSuperMember(
|
||||
_analyzedMember, node.name, node.interfaceTarget,
|
||||
setter: true);
|
||||
MemberEntity member =
|
||||
_elementMap.getSuperMember(_analyzedMember, node.name, setter: true);
|
||||
AbstractValue mask = _memberData.typeOfSend(node);
|
||||
Selector selector = new Selector.setter(_elementMap.getName(node.name));
|
||||
ArgumentsTypes arguments = new ArgumentsTypes([rhsType], null);
|
||||
|
@ -1720,8 +1719,8 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation> {
|
|||
// are calling does not expose this.
|
||||
_markThisAsExposed();
|
||||
|
||||
MemberEntity member = _elementMap.getSuperMember(
|
||||
_analyzedMember, node.name, node.interfaceTarget);
|
||||
MemberEntity member =
|
||||
_elementMap.getSuperMember(_analyzedMember, node.name);
|
||||
ArgumentsTypes arguments = analyzeArguments(node.arguments);
|
||||
Selector selector = _elementMap.getSelector(node);
|
||||
AbstractValue mask = _memberData.typeOfSend(node);
|
||||
|
|
|
@ -283,5 +283,6 @@ class CodegenEnqueuer extends EnqueuerImpl {
|
|||
Iterable<MemberEntity> get processedEntities => _processedEntities;
|
||||
|
||||
@override
|
||||
Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses;
|
||||
Iterable<ClassEntity> get processedClasses =>
|
||||
_worldBuilder.instantiatedClasses;
|
||||
}
|
||||
|
|
|
@ -1583,8 +1583,9 @@ class Namer {
|
|||
jsAst.Name aliasedSuperMemberPropertyName(MemberEntity member) {
|
||||
assert(!member.isField); // Fields do not need super aliases.
|
||||
return _disambiguateInternalMember(member, () {
|
||||
String className = member.enclosingClass.name.replaceAll('&', '_');
|
||||
String invocationName = operatorNameToIdentifier(member.name);
|
||||
return "super\$${member.enclosingClass.name}\$$invocationName";
|
||||
return "super\$${className}\$$invocationName";
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ class TrivialRuntimeTypesChecksBuilder implements RuntimeTypesChecksBuilder {
|
|||
.getClassSet(_closedWorld.commonElements.objectClass)
|
||||
.subtypes()) {
|
||||
ClassUse classUse = new ClassUse()
|
||||
..instance = true
|
||||
..directInstance = true
|
||||
..checkedInstance = true
|
||||
..typeArgument = true
|
||||
..checkedTypeArgument = true
|
||||
|
@ -357,7 +357,10 @@ abstract class RuntimeTypesSubstitutionsMixin
|
|||
ClassEntity other = cls;
|
||||
while (other != null) {
|
||||
inheritedClasses.add(other);
|
||||
if (_elementEnvironment.isMixinApplication(other)) {
|
||||
if (classUse.instance &&
|
||||
_elementEnvironment.isMixinApplication(other)) {
|
||||
// We don't mixin [other] if [cls] isn't instantiated, directly or
|
||||
// indirectly.
|
||||
inheritedClasses
|
||||
.add(_elementEnvironment.getEffectiveMixinClass(other));
|
||||
}
|
||||
|
@ -494,7 +497,9 @@ abstract class RuntimeTypesSubstitutionsMixin
|
|||
|
||||
for (ClassEntity cls in classUseMap.keys) {
|
||||
ClassUse classUse = classUseMap[cls] ?? emptyUse;
|
||||
if (classUse.instance || classUse.typeArgument || classUse.typeLiteral) {
|
||||
if (classUse.directInstance ||
|
||||
classUse.typeArgument ||
|
||||
classUse.typeLiteral) {
|
||||
// Add checks only for classes that are live either as instantiated
|
||||
// classes or type arguments passed at runtime.
|
||||
computeChecks(cls);
|
||||
|
@ -1935,11 +1940,16 @@ class RuntimeTypesImpl extends _RuntimeTypesBase
|
|||
}
|
||||
});
|
||||
|
||||
codegenWorldBuilder.instantiatedClasses.forEach((ClassEntity cls) {
|
||||
ClassUse classUse = classUseMap.putIfAbsent(cls, () => new ClassUse());
|
||||
classUse.instance = true;
|
||||
});
|
||||
|
||||
codegenWorldBuilder.instantiatedTypes.forEach((InterfaceType type) {
|
||||
liveTypeVisitor.visitType(type, TypeVisitorState.direct);
|
||||
ClassUse classUse =
|
||||
classUseMap.putIfAbsent(type.element, () => new ClassUse());
|
||||
classUse.instance = true;
|
||||
classUse.directInstance = true;
|
||||
FunctionType callType = _types.getCallType(type);
|
||||
if (callType != null) {
|
||||
testedTypeVisitor.visitType(callType, TypeVisitorState.direct);
|
||||
|
@ -2838,15 +2848,26 @@ class ClassFunctionType {
|
|||
|
||||
/// Runtime type usage for a class.
|
||||
class ClassUse {
|
||||
/// Whether the class is instantiated.
|
||||
/// Whether the class is directly or indirectly instantiated.
|
||||
///
|
||||
/// For instance `A` in:
|
||||
/// For instance `A` and `B` in:
|
||||
///
|
||||
/// class A {}
|
||||
/// main() => new A();
|
||||
/// class B extends A {}
|
||||
/// main() => new B();
|
||||
///
|
||||
bool instance = false;
|
||||
|
||||
/// Whether the class is directly instantiated.
|
||||
///
|
||||
/// For instance `B` in:
|
||||
///
|
||||
/// class A {}
|
||||
/// class B extends A {}
|
||||
/// main() => new B();
|
||||
///
|
||||
bool directInstance = false;
|
||||
|
||||
/// Whether objects are checked to be instances of the class.
|
||||
///
|
||||
/// For instance `A` in:
|
||||
|
@ -2895,13 +2916,16 @@ class ClassUse {
|
|||
|
||||
/// `true` if the class is 'live' either through instantiation or use in
|
||||
/// type arguments.
|
||||
bool get isLive => instance || typeArgument;
|
||||
bool get isLive => directInstance || typeArgument;
|
||||
|
||||
String toString() {
|
||||
List<String> properties = <String>[];
|
||||
if (instance) {
|
||||
properties.add('instance');
|
||||
}
|
||||
if (directInstance) {
|
||||
properties.add('directInstance');
|
||||
}
|
||||
if (checkedInstance) {
|
||||
properties.add('checkedInstance');
|
||||
}
|
||||
|
|
|
@ -78,12 +78,7 @@ abstract class JsToElementMap {
|
|||
|
||||
/// Returns the super [MemberEntity] for a super invocation, get or set of
|
||||
/// [name] from the member [context].
|
||||
///
|
||||
/// The IR doesn't always resolve super accesses to the corresponding
|
||||
/// [target]. If not, the target is computed using [name] and [setter] from
|
||||
/// the enclosing class of [context].
|
||||
MemberEntity getSuperMember(
|
||||
MemberEntity context, ir.Name name, ir.Member target,
|
||||
MemberEntity getSuperMember(MemberEntity context, ir.Name name,
|
||||
{bool setter: false});
|
||||
|
||||
/// Returns the `noSuchMethod` [FunctionEntity] call from a
|
||||
|
|
|
@ -67,7 +67,7 @@ abstract class JsToWorldBuilder implements JsToElementMap {
|
|||
void f(DartType type, String name, ConstantValue defaultValue));
|
||||
}
|
||||
|
||||
abstract class JsToElementMapBase implements IrToElementMap {
|
||||
abstract class JsToElementMapBase implements IrToElementMap, JsToElementMap {
|
||||
final CompilerOptions options;
|
||||
final DiagnosticReporter reporter;
|
||||
CommonElementsImpl _commonElements;
|
||||
|
@ -361,13 +361,11 @@ abstract class JsToElementMapBase implements IrToElementMap {
|
|||
throw new UnsupportedError("Unexpected member: $node");
|
||||
}
|
||||
|
||||
MemberEntity getSuperMember(
|
||||
MemberEntity context, ir.Name name, ir.Member target,
|
||||
MemberEntity getSuperMember(MemberEntity context, ir.Name name,
|
||||
{bool setter: false}) {
|
||||
if (target != null && !target.isAbstract && target.isInstanceMember) {
|
||||
return getMember(target);
|
||||
}
|
||||
ClassEntity cls = context.enclosingClass;
|
||||
// We can no longer trust the interface target of the super access since it
|
||||
// might be a member that we have cloned.
|
||||
ClassEntity cls = getMemberThisType(context).element;
|
||||
assert(
|
||||
cls != null,
|
||||
failedAt(context,
|
||||
|
|
|
@ -76,12 +76,7 @@ abstract class KernelToElementMap {
|
|||
|
||||
/// Returns the super [MemberEntity] for a super invocation, get or set of
|
||||
/// [name] from the member [context].
|
||||
///
|
||||
/// The IR doesn't always resolve super accesses to the corresponding
|
||||
/// [target]. If not, the target is computed using [name] and [setter] from
|
||||
/// the enclosing class of [context].
|
||||
MemberEntity getSuperMember(
|
||||
MemberEntity context, ir.Name name, ir.Member target,
|
||||
MemberEntity getSuperMember(MemberEntity context, ir.Name name,
|
||||
{bool setter: false});
|
||||
|
||||
/// Returns the `noSuchMethod` [FunctionEntity] call from a
|
||||
|
|
|
@ -365,12 +365,10 @@ abstract class KernelToElementMapBase implements IrToElementMap {
|
|||
throw new UnsupportedError("Unexpected member: $node");
|
||||
}
|
||||
|
||||
MemberEntity getSuperMember(
|
||||
MemberEntity context, ir.Name name, ir.Member target,
|
||||
MemberEntity getSuperMember(MemberEntity context, ir.Name name,
|
||||
{bool setter: false}) {
|
||||
if (target != null && !target.isAbstract && target.isInstanceMember) {
|
||||
return getMember(target);
|
||||
}
|
||||
// We can no longer trust the interface target of the super access since it
|
||||
// might be a member that we have cloned.
|
||||
ClassEntity cls = context.enclosingClass;
|
||||
assert(
|
||||
cls != null,
|
||||
|
|
|
@ -440,7 +440,8 @@ class KClassEnvImpl implements KClassEnv {
|
|||
for (ir.Field field in cls.mixedInClass.mixin.fields) {
|
||||
if (field.containsSuperCalls) {
|
||||
_isSuperMixinApplication = true;
|
||||
cloneVisitor ??= new SuperCloner(getSubstitutionMap(cls.mixedInType));
|
||||
cloneVisitor ??= new CloneVisitor(
|
||||
typeSubstitution: getSubstitutionMap(cls.mixedInType));
|
||||
cls.addMember(cloneVisitor.clone(field));
|
||||
continue;
|
||||
}
|
||||
|
@ -449,7 +450,8 @@ class KClassEnvImpl implements KClassEnv {
|
|||
for (ir.Procedure procedure in cls.mixedInClass.mixin.procedures) {
|
||||
if (procedure.containsSuperCalls) {
|
||||
_isSuperMixinApplication = true;
|
||||
cloneVisitor ??= new SuperCloner(getSubstitutionMap(cls.mixedInType));
|
||||
cloneVisitor ??= new CloneVisitor(
|
||||
typeSubstitution: getSubstitutionMap(cls.mixedInType));
|
||||
cls.addMember(cloneVisitor.clone(procedure));
|
||||
continue;
|
||||
}
|
||||
|
@ -925,29 +927,3 @@ class KTypeVariableData {
|
|||
return new JTypeVariableData(node);
|
||||
}
|
||||
}
|
||||
|
||||
class SuperCloner extends CloneVisitor {
|
||||
SuperCloner(Map<ir.TypeParameter, ir.DartType> typeSubstitution)
|
||||
: super(typeSubstitution: typeSubstitution, cloneAnnotations: true);
|
||||
|
||||
@override
|
||||
visitSuperMethodInvocation(ir.SuperMethodInvocation node) {
|
||||
// We ensure that we re-resolve the target by setting the interface target
|
||||
// to `null`.
|
||||
return new ir.SuperMethodInvocation(node.name, clone(node.arguments));
|
||||
}
|
||||
|
||||
@override
|
||||
visitSuperPropertyGet(ir.SuperPropertyGet node) {
|
||||
// We ensure that we re-resolve the target by setting the interface target
|
||||
// to `null`.
|
||||
return new ir.SuperPropertyGet(node.name);
|
||||
}
|
||||
|
||||
@override
|
||||
visitSuperPropertySet(ir.SuperPropertySet node) {
|
||||
// We ensure that we re-resolve the target by setting the interface target
|
||||
// to `null`.
|
||||
return new ir.SuperPropertySet(node.name, clone(node.value), null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -470,9 +470,9 @@ class KernelImpactBuilder extends StaticTypeVisitor {
|
|||
return super.visitStaticSet(node);
|
||||
}
|
||||
|
||||
void handleSuperInvocation(ir.Name name, ir.Node target, ir.Node arguments) {
|
||||
void handleSuperInvocation(ir.Name name, ir.Node arguments) {
|
||||
FunctionEntity method =
|
||||
elementMap.getSuperMember(currentMember, name, target, setter: false);
|
||||
elementMap.getSuperMember(currentMember, name, setter: false);
|
||||
_visitArguments(arguments);
|
||||
if (method != null) {
|
||||
impactBuilder.registerStaticUse(new StaticUse.superInvoke(
|
||||
|
@ -506,13 +506,13 @@ class KernelImpactBuilder extends StaticTypeVisitor {
|
|||
ir.DartType visitSuperMethodInvocation(ir.SuperMethodInvocation node) {
|
||||
// TODO(johnniwinther): Should we support this or always use the
|
||||
// [MixinFullResolution] transformer?
|
||||
handleSuperInvocation(node.name, node.interfaceTarget, node.arguments);
|
||||
handleSuperInvocation(node.name, node.arguments);
|
||||
return super.visitSuperMethodInvocation(node);
|
||||
}
|
||||
|
||||
void handleSuperGet(ir.Name name, ir.Member target) {
|
||||
MemberEntity member =
|
||||
elementMap.getSuperMember(currentMember, name, target, setter: false);
|
||||
elementMap.getSuperMember(currentMember, name, setter: false);
|
||||
if (member != null) {
|
||||
if (member.isFunction) {
|
||||
impactBuilder.registerStaticUse(new StaticUse.superTearOff(member));
|
||||
|
@ -544,7 +544,7 @@ class KernelImpactBuilder extends StaticTypeVisitor {
|
|||
|
||||
void handleSuperSet(ir.Name name, ir.Node target, ir.Node value) {
|
||||
MemberEntity member =
|
||||
elementMap.getSuperMember(currentMember, name, target, setter: true);
|
||||
elementMap.getSuperMember(currentMember, name, setter: true);
|
||||
if (member != null) {
|
||||
if (member.isField) {
|
||||
impactBuilder.registerStaticUse(new StaticUse.superFieldSet(member));
|
||||
|
|
|
@ -3020,9 +3020,8 @@ class KernelSsaGraphBuilder extends ir.Visitor
|
|||
node.value.accept(this);
|
||||
HInstruction value = pop();
|
||||
|
||||
MemberEntity member = _elementMap.getSuperMember(
|
||||
_currentFrame.member, node.name, node.interfaceTarget,
|
||||
setter: true);
|
||||
MemberEntity member = _elementMap
|
||||
.getSuperMember(_currentFrame.member, node.name, setter: true);
|
||||
if (member == null) {
|
||||
_generateSuperNoSuchMethod(node, _elementMap.getSelector(node).name + "=",
|
||||
<HInstruction>[value], const <DartType>[], sourceInformation);
|
||||
|
@ -4545,8 +4544,8 @@ class KernelSsaGraphBuilder extends ir.Visitor
|
|||
void visitSuperPropertyGet(ir.SuperPropertyGet node) {
|
||||
SourceInformation sourceInformation =
|
||||
_sourceInformationBuilder.buildGet(node);
|
||||
MemberEntity member = _elementMap.getSuperMember(
|
||||
_currentFrame.member, node.name, node.interfaceTarget);
|
||||
MemberEntity member =
|
||||
_elementMap.getSuperMember(_currentFrame.member, node.name);
|
||||
if (member == null) {
|
||||
_generateSuperNoSuchMethod(node, _elementMap.getSelector(node).name,
|
||||
const <HInstruction>[], const <DartType>[], sourceInformation);
|
||||
|
@ -4565,8 +4564,8 @@ class KernelSsaGraphBuilder extends ir.Visitor
|
|||
void visitSuperMethodInvocation(ir.SuperMethodInvocation node) {
|
||||
SourceInformation sourceInformation =
|
||||
_sourceInformationBuilder.buildCall(node, node);
|
||||
MemberEntity member = _elementMap.getSuperMember(
|
||||
_currentFrame.member, node.name, node.interfaceTarget);
|
||||
MemberEntity member =
|
||||
_elementMap.getSuperMember(_currentFrame.member, node.name);
|
||||
if (member == null) {
|
||||
Selector selector = _elementMap.getSelector(node);
|
||||
List<DartType> typeArguments = <DartType>[];
|
||||
|
|
|
@ -8,6 +8,9 @@ part of world_builder;
|
|||
///
|
||||
/// This adds additional access to liveness of selectors and elements.
|
||||
abstract class CodegenWorldBuilder implements WorldBuilder {
|
||||
/// All directly or indirectly instantiated classes.
|
||||
Iterable<ClassEntity> get instantiatedClasses;
|
||||
|
||||
/// Calls [f] with every instance field, together with its declarer, in an
|
||||
/// instance of [cls]. All fields inherited from superclasses and mixins are
|
||||
/// included.
|
||||
|
@ -179,7 +182,7 @@ class CodegenWorldBuilderImpl extends WorldBuilderBase
|
|||
this._world,
|
||||
this.selectorConstraintsStrategy);
|
||||
|
||||
Iterable<ClassEntity> get processedClasses => _processedClasses.keys
|
||||
Iterable<ClassEntity> get instantiatedClasses => _processedClasses.keys
|
||||
.where((cls) => _processedClasses[cls].isInstantiated);
|
||||
|
||||
/// All directly instantiated classes, that is, classes with a generative
|
||||
|
|
|
@ -66,12 +66,6 @@ Language/Types/Interface_Types/subtype_t26: RuntimeError
|
|||
Language/Types/Interface_Types/subtype_t27: Pass, Crash # Issue 34389
|
||||
Language/Types/Type_Declarations/Typedef/dynamic_param_type_t02: RuntimeError
|
||||
Language/Variables/constant_initialization_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_arguments_binding_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_arguments_binding_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_arguments_binding_A02_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_global_variable_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A52_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A52_t02: RuntimeError
|
||||
|
@ -92,8 +86,6 @@ LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_clas
|
|||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_global_variable_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_global_variable_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_return_value_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t03: RuntimeError
|
||||
LayoutTests/fast/alignment/parse-align-items_t01: RuntimeError
|
||||
LayoutTests/fast/alignment/parse-align-self_t01: RuntimeError
|
||||
LayoutTests/fast/alignment/parse-justify-self_t01: RuntimeError
|
||||
|
@ -1285,9 +1277,6 @@ Language/Types/Interface_Types/subtype_t21: RuntimeError
|
|||
Language/Types/Interface_Types/subtype_t23: RuntimeError
|
||||
Language/Variables/constant_variable_t09: RuntimeError
|
||||
LanguageFeatures/Instantiate-to-bound/check_types/typedef_param_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_local_variable_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_return_value_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A53_t01: RuntimeError
|
||||
|
@ -1313,10 +1302,6 @@ LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_clas
|
|||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_return_value_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LayoutTests/fast/animation/request-animation-frame-cancel2_t01: Timeout, Pass
|
||||
LayoutTests/fast/animation/request-animation-frame-cancel_t01: Timeout, Pass
|
||||
LayoutTests/fast/animation/request-animation-frame-prefix_t01: Timeout, Pass
|
||||
|
@ -3528,9 +3513,6 @@ LanguageFeatures/Instantiate-to-bound/Callable/Callable_ret_extends_neg_assign_l
|
|||
LanguageFeatures/Instantiate-to-bound/Callable/Callable_ret_extends_neg_assign_l1_t09: MissingCompileTimeError
|
||||
LanguageFeatures/Instantiate-to-bound/Callable/Callable_ret_extends_neg_assign_l1_t10: MissingCompileTimeError
|
||||
LanguageFeatures/Instantiate-to-bound/check_types/typedef_param_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_local_variable_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_return_value_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A53_t01: RuntimeError
|
||||
|
@ -3556,10 +3538,6 @@ LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_clas
|
|||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_return_value_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LayoutTests/fast/animation/request-animation-frame-prefix_t01: RuntimeError
|
||||
LayoutTests/fast/backgrounds/animated-gif-as-background_t01: RuntimeError
|
||||
LayoutTests/fast/backgrounds/background-fill-zero-area-crash_t01: RuntimeError
|
||||
|
@ -5176,9 +5154,6 @@ Language/Types/Interface_Types/subtype_t21: RuntimeError
|
|||
Language/Types/Interface_Types/subtype_t23: RuntimeError
|
||||
Language/Variables/constant_variable_t09: RuntimeError
|
||||
LanguageFeatures/Instantiate-to-bound/check_types/typedef_param_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_local_variable_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_return_value_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A53_t01: RuntimeError
|
||||
|
@ -5204,10 +5179,6 @@ LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_clas
|
|||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_return_value_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LayoutTests/fast/animation/request-animation-frame-cancel_t01: Timeout, Pass
|
||||
LayoutTests/fast/animation/request-animation-frame-timestamps-advance_t01: Timeout, Pass
|
||||
LayoutTests/fast/backgrounds/background-position-parsing-2_t01: RuntimeError
|
||||
|
@ -6100,9 +6071,6 @@ Language/Types/Interface_Types/subtype_t21: RuntimeError
|
|||
Language/Types/Interface_Types/subtype_t23: RuntimeError
|
||||
Language/Variables/constant_variable_t09: RuntimeError
|
||||
LanguageFeatures/Instantiate-to-bound/check_types/typedef_param_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_local_variable_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_return_value_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A53_t01: RuntimeError
|
||||
|
@ -6128,10 +6096,6 @@ LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_clas
|
|||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_return_value_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LayoutTests/fast/animation/request-animation-frame-prefix_t01: Timeout, Pass
|
||||
LayoutTests/fast/backgrounds/background-position-parsing-2_t01: RuntimeError
|
||||
LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style_t01: RuntimeError
|
||||
|
@ -7029,9 +6993,6 @@ Language/Types/Interface_Types/subtype_t21: RuntimeError
|
|||
Language/Types/Interface_Types/subtype_t23: RuntimeError
|
||||
Language/Variables/constant_variable_t09: RuntimeError
|
||||
LanguageFeatures/Instantiate-to-bound/check_types/typedef_param_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_local_variable_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/interface_compositionality_return_value_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A51_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/named_function_types_fail_arguments_binding_fail_A53_t01: RuntimeError
|
||||
|
@ -7057,10 +7018,6 @@ LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_clas
|
|||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A31_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_local_variable_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/dynamic/generated/positional_function_types_fail_return_value_fail_A32_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_arguments_binding_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t01: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t02: RuntimeError
|
||||
LanguageFeatures/Subtyping/static/generated/interface_compositionality_class_member_A02_t03: RuntimeError
|
||||
LayoutTests/fast/backgrounds/background-position-parsing-2_t01: RuntimeError
|
||||
LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style_t01: RuntimeError
|
||||
LayoutTests/fast/backgrounds/repeat/parsing-background-repeat_t01: RuntimeError
|
||||
|
|
|
@ -29,7 +29,7 @@ class A2 {}
|
|||
/*class: B2:checks=[],instance*/
|
||||
class B2 implements A2 {}
|
||||
|
||||
/*class: Test2:checks=[]*/
|
||||
/*class: Test2:checks=[],indirectInstance*/
|
||||
abstract class Test2 {
|
||||
@noInline
|
||||
Test2(A2 x) {
|
||||
|
|
|
@ -11,7 +11,7 @@ class A {}
|
|||
/*class: B:checks=[]*/
|
||||
class B implements A {}
|
||||
|
||||
/*class: C:checks=[$isA]*/
|
||||
/*class: C:checks=[$isA],indirectInstance*/
|
||||
class C = Object with B;
|
||||
|
||||
/*class: D:checks=[],instance*/
|
||||
|
|
|
@ -8,10 +8,10 @@ import 'package:meta/dart2js.dart';
|
|||
/*class: A:checkedInstance*/
|
||||
class A {}
|
||||
|
||||
/*class: B:checks=[$isA]*/
|
||||
/*class: B:checks=[$isA],indirectInstance*/
|
||||
class B implements A {}
|
||||
|
||||
/*class: C:checks=[]*/
|
||||
/*class: C:checks=[],indirectInstance*/
|
||||
class C extends B {}
|
||||
|
||||
/*class: D:checks=[],instance*/
|
||||
|
|
|
@ -11,16 +11,16 @@ class M<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/*class: A:checks=[]*/
|
||||
/*class: A:checks=[],indirectInstance*/
|
||||
class A<U> = Object with M<U>;
|
||||
|
||||
/*class: B:checks=[]*/
|
||||
/*class: B:checks=[],indirectInstance*/
|
||||
class B<V> = Object with A<V>;
|
||||
|
||||
/*class: C:checks=[$asM]*/
|
||||
/*class: C:checks=[$asM],indirectInstance*/
|
||||
class C<U> = Object with M<List<U>>;
|
||||
|
||||
/*class: D:checks=[$asM]*/
|
||||
/*class: D:checks=[$asM],indirectInstance*/
|
||||
class D<V> = Object with C<Set<V>>;
|
||||
|
||||
/*class: E:checks=[$asM],instance*/
|
||||
|
|
|
@ -10,7 +10,7 @@ class I<T> {}
|
|||
/*class: J:checkedInstance*/
|
||||
class J<T> {}
|
||||
|
||||
/*class: S:checkedInstance,checks=[]*/
|
||||
/*class: S:checkedInstance,checks=[],indirectInstance*/
|
||||
class S<T> {}
|
||||
|
||||
/*class: M:checkedInstance,checks=[]*/
|
||||
|
|
112
tests/compiler/dart2js/rti/emission/mixin_subtype.dart
Normal file
112
tests/compiler/dart2js/rti/emission/mixin_subtype.dart
Normal file
|
@ -0,0 +1,112 @@
|
|||
// 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.
|
||||
|
||||
// Derived from language_2/mixin_declaration/mixin_declaration_subtype_test.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// A mixin declaration introduces a type.
|
||||
|
||||
// A mixin with multiple super-types and implemented types.
|
||||
|
||||
/*class: A:checkedInstance,checks=[],typeArgument*/
|
||||
class A {}
|
||||
|
||||
/*class: B:checkedInstance,checks=[],typeArgument*/
|
||||
class B {}
|
||||
|
||||
/*class: I:checkedInstance,checks=[],typeArgument*/
|
||||
class I {}
|
||||
|
||||
/*class: J:checkedInstance,checks=[],typeArgument*/
|
||||
class J {}
|
||||
|
||||
/*class: M1:checkedInstance,checks=[$isA,$isB,$isI,$isJ],typeArgument*/
|
||||
mixin M1 on A, B implements I, J {}
|
||||
|
||||
/*class: M2:checkedInstance,checks=[$isA,$isB,$isI,$isJ],typeArgument*/
|
||||
class M2 implements A, B, I, J {}
|
||||
|
||||
/*class: M3:checkedInstance,checks=[$isA,$isB,$isI,$isJ],instance,typeArgument*/
|
||||
class M3 implements A, B, I, J {}
|
||||
|
||||
/*class: M4:checkedInstance,checks=[$isA,$isB,$isI,$isJ],typeArgument*/
|
||||
class M4 implements A, B, I, J {}
|
||||
|
||||
/*class: M5:checkedInstance,checks=[$isA,$isB,$isI,$isJ],typeArgument*/
|
||||
class M5 implements A, B, I, J {}
|
||||
|
||||
/*class: C:checkedInstance,checks=[$isA,$isB],indirectInstance,typeArgument*/
|
||||
class C implements A, B {}
|
||||
|
||||
/*class: D1:checkedInstance,checks=[$isI,$isJ,$isM1],typeArgument*/
|
||||
class D1 = C with M1;
|
||||
|
||||
/*class: D2:checkedInstance,checks=[$isI,$isJ],instance,typeArgument*/
|
||||
class D2 = C with M2;
|
||||
|
||||
/*class: D3:checkedInstance,checks=[$isI,$isJ,$isM3],typeArgument*/
|
||||
class D3 = C with M3;
|
||||
|
||||
/*class: D4:checkedInstance,checks=[$isI,$isJ],instance,typeArgument*/
|
||||
class D4 extends C with M4 {}
|
||||
|
||||
/*class: D5:checkedInstance,checks=[$isI,$isJ],indirectInstance,typeArgument*/
|
||||
class D5 extends C with M5 {}
|
||||
|
||||
/*class: E5:checkedInstance,checks=[],instance,typeArgument*/
|
||||
class E5 extends D5 {}
|
||||
|
||||
// Same, with generics.
|
||||
/*class: GA:checkedInstance,checks=[],typeArgument*/
|
||||
class GA<T> {}
|
||||
|
||||
/*class: GB:checkedInstance,checks=[],typeArgument*/
|
||||
class GB<T> {}
|
||||
|
||||
/*class: GI:checkedInstance,checks=[],typeArgument*/
|
||||
class GI<T> {}
|
||||
|
||||
/*class: GJ:checkedInstance,checks=[],typeArgument*/
|
||||
class GJ<T> {}
|
||||
|
||||
/*class: GM:checkedInstance,checks=[$asGA,$asGB,$asGI,$asGJ,$isGA,$isGB,$isGI,$isGJ],typeArgument*/
|
||||
mixin GM<T> on GA<T>, GB<List<T>> implements GI<Iterable<T>>, GJ<Set<T>> {}
|
||||
|
||||
/*class: GC:checkedInstance,checks=[$asGB,$isGA,$isGB],typeArgument*/
|
||||
class GC<T> implements GA<T>, GB<List<T>> {}
|
||||
|
||||
/*class: GD:checkedInstance,checks=[$asGI,$asGJ,$isGI,$isGJ,$isGM],typeArgument*/
|
||||
class GD<T> = GC<T> with GM<T>;
|
||||
|
||||
@NoInline()
|
||||
test(o) {}
|
||||
|
||||
main() {
|
||||
test(new M3());
|
||||
test(new D2());
|
||||
test(new D4());
|
||||
test(new E5());
|
||||
Expect.subtype<M1, A>();
|
||||
Expect.subtype<M1, B>();
|
||||
Expect.subtype<M1, I>();
|
||||
Expect.subtype<M1, J>();
|
||||
Expect.subtype<D1, M1>();
|
||||
Expect.subtype<D2, M2>();
|
||||
Expect.subtype<D3, M3>();
|
||||
Expect.subtype<D4, M4>();
|
||||
Expect.subtype<D5, M5>();
|
||||
Expect.subtype<E5, M5>();
|
||||
Expect.notSubtype<M1, C>();
|
||||
Expect.notSubtype<C, M1>();
|
||||
|
||||
Expect.subtype<GM<int>, GA<int>>();
|
||||
Expect.subtype<GM<int>, GB<List<int>>>();
|
||||
Expect.subtype<GM<int>, GI<Iterable<int>>>();
|
||||
Expect.subtype<GM<int>, GJ<Set<int>>>();
|
||||
Expect.subtype<GD<int>, GM<int>>();
|
||||
Expect.subtype<GD<int>, GC<int>>();
|
||||
Expect.notSubtype<GM<int>, GC<int>>();
|
||||
Expect.notSubtype<GC<int>, GM<int>>();
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
/*class: T:checks=[]*/
|
||||
/*class: T:checks=[],indirectInstance*/
|
||||
class T<X> {
|
||||
final Type tType = X;
|
||||
Type get getTType => X;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: B:checkedInstance,checks=[],typeLiteral*/
|
||||
/*class: B:checkedInstance,checks=[],indirectInstance,typeLiteral*/
|
||||
class B {}
|
||||
|
||||
/*class: C:checks=[],instance*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:meta/dart2js.dart';
|
|||
/*class: A:checkedInstance,checks=[],instance*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checks=[]*/
|
||||
/*class: B:checks=[],indirectInstance*/
|
||||
class B<T, S> {
|
||||
@noInline
|
||||
method() => new A<S>();
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:meta/dart2js.dart';
|
|||
/*class: A:checkedTypeArgument,checks=[],typeArgument*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checkedInstance,checks=[]*/
|
||||
/*class: B:checkedInstance,checks=[],indirectInstance*/
|
||||
class B<T> {}
|
||||
|
||||
/*class: C:checks=[$asB],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: B:checkedInstance,checks=[]*/
|
||||
/*class: B:checkedInstance,checks=[],indirectInstance*/
|
||||
class B<T> {}
|
||||
|
||||
/*class: C:checks=[$asB],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checks=[]*/
|
||||
/*class: A:checks=[],indirectInstance*/
|
||||
class A {}
|
||||
|
||||
/*class: B:checkedInstance*/
|
||||
|
|
|
@ -10,7 +10,7 @@ class A<T> {}
|
|||
/*class: B:checkedInstance*/
|
||||
class B<T> {}
|
||||
|
||||
/*class: C:checks=[]*/
|
||||
/*class: C:checks=[],indirectInstance*/
|
||||
class C<T> {}
|
||||
|
||||
/*class: D:checks=[$asB,$isB],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checks=[]*/
|
||||
/*class: A:checks=[],indirectInstance*/
|
||||
class A {}
|
||||
|
||||
/*class: B:checkedInstance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checks=[]*/
|
||||
/*class: A:checks=[],indirectInstance*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checkedInstance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: B:checkedInstance,checks=[]*/
|
||||
/*class: B:checkedInstance,checks=[],indirectInstance*/
|
||||
class B<T> {}
|
||||
|
||||
/*class: C:checks=[],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checkedInstance,checks=[]*/
|
||||
/*class: A:checkedInstance,checks=[],indirectInstance*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checks=[$asA],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checkedInstance,checks=[]*/
|
||||
/*class: A:checkedInstance,checks=[],indirectInstance*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checks=[$asA],instance*/
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:meta/dart2js.dart';
|
|||
/*class: A:checkedInstance*/
|
||||
class A {}
|
||||
|
||||
/*class: B:checks=[$isA]*/
|
||||
/*class: B:checks=[$isA],indirectInstance*/
|
||||
class B implements A {}
|
||||
|
||||
/*class: C:checks=[],instance*/
|
||||
|
|
|
@ -7,10 +7,10 @@ import 'package:meta/dart2js.dart';
|
|||
/*class: A:checkedInstance*/
|
||||
class A {}
|
||||
|
||||
/*class: B:checks=[$isA]*/
|
||||
/*class: B:checks=[$isA],indirectInstance*/
|
||||
class B implements A {}
|
||||
|
||||
/*class: C:checks=[]*/
|
||||
/*class: C:checks=[],indirectInstance*/
|
||||
class C extends B {} // Implements A through `extends B`.
|
||||
|
||||
/*class: D:checks=[],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checkedInstance,checks=[]*/
|
||||
/*class: A:checkedInstance,checks=[],indirectInstance*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checks=[$asA],instance*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:meta/dart2js.dart';
|
||||
|
||||
/*class: A:checkedInstance,checks=[]*/
|
||||
/*class: A:checkedInstance,checks=[],indirectInstance*/
|
||||
class A<T> {}
|
||||
|
||||
/*class: B:checks=[$asA],instance*/
|
||||
|
|
|
@ -30,7 +30,8 @@ main(List<String> args) {
|
|||
|
||||
class Tags {
|
||||
static const String isChecks = 'checks';
|
||||
static const String instance = 'instance';
|
||||
static const String indirectInstance = 'indirectInstance';
|
||||
static const String directInstance = 'instance';
|
||||
static const String checkedInstance = 'checkedInstance';
|
||||
static const String typeArgument = 'typeArgument';
|
||||
static const String checkedTypeArgument = 'checkedTypeArgument';
|
||||
|
@ -60,9 +61,12 @@ abstract class ComputeValueMixin {
|
|||
}
|
||||
ClassUse classUse = checksBuilder.classUseMapForTesting[element];
|
||||
if (classUse != null) {
|
||||
if (classUse.instance) {
|
||||
features.add(Tags.instance);
|
||||
if (classUse.directInstance) {
|
||||
features.add(Tags.directInstance);
|
||||
} else if (classUse.instance) {
|
||||
features.add(Tags.indirectInstance);
|
||||
}
|
||||
|
||||
if (classUse.checkedInstance) {
|
||||
features.add(Tags.checkedInstance);
|
||||
}
|
||||
|
|
53
tests/compiler/dart2js_extra/mixin_subtype_test.dart
Normal file
53
tests/compiler/dart2js_extra/mixin_subtype_test.dart
Normal file
|
@ -0,0 +1,53 @@
|
|||
// 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.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class A {}
|
||||
|
||||
class B {}
|
||||
|
||||
class I {}
|
||||
|
||||
class J {}
|
||||
|
||||
mixin M1 on A, B implements I, J {}
|
||||
|
||||
class M2 implements A, B, I, J {}
|
||||
|
||||
class M3 implements A, B, I, J {}
|
||||
|
||||
class M4 implements A, B, I, J {}
|
||||
|
||||
class M5 implements A, B, I, J {}
|
||||
|
||||
class C implements A, B {}
|
||||
|
||||
class D1 = C with M1;
|
||||
|
||||
class D2 = C with M2;
|
||||
|
||||
class D3 = C with M3;
|
||||
|
||||
class D4 extends C with M4 {}
|
||||
|
||||
class D5 extends C with M5 {}
|
||||
|
||||
class E5 extends D5 {}
|
||||
|
||||
@NoInline()
|
||||
test(o) {}
|
||||
|
||||
main() {
|
||||
test(new M3());
|
||||
test(new D2());
|
||||
test(new D4());
|
||||
test(new E5());
|
||||
Expect.subtype<D1, M1>();
|
||||
Expect.subtype<D2, M2>();
|
||||
Expect.subtype<D3, M3>();
|
||||
Expect.subtype<D4, M4>();
|
||||
Expect.subtype<D5, M5>();
|
||||
Expect.subtype<E5, M5>();
|
||||
}
|
|
@ -56,8 +56,6 @@ list_test: CompileTimeError, OK # Error if web int literal cannot be represented
|
|||
mint_arithmetic_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
|
||||
mint_compares_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
|
||||
mint_identical_test: CompileTimeError, OK # Error if web int literal cannot be represented exactly, see http://dartbug.com/33351
|
||||
mixin_declaration/mixin_declaration_subtype_test: RuntimeError
|
||||
mixin_declaration/mixin_declaration_syntax_test: RuntimeError
|
||||
mixin_type_parameter_inference_error_test/none: CompileTimeError
|
||||
mixin_type_parameter_inference_previous_mixin_test/01: CompileTimeError
|
||||
mixin_type_parameter_inference_previous_mixin_test/02: CompileTimeError
|
||||
|
|
|
@ -191,7 +191,7 @@ abstract class OaMiIJ = O with MiIJ;
|
|||
|
||||
// Concrete subclass of abstract mixin appliction
|
||||
class COaMiIJ extends OaMiIJ {
|
||||
String toString() => "${super.toString()}:$COaMiIJ";
|
||||
String toString() => "${super.toString()}:COaMiIJ";
|
||||
String methodI() => "COaMiIJ:${this}.I";
|
||||
String methodJ() => "COaMiIJ:${this}.J";
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ abstract class OaMiIJ_2 extends O with MiIJ {}
|
|||
|
||||
// Concrete subclass of abstract mixin appliction
|
||||
class COaMiIJ_2 extends OaMiIJ_2 {
|
||||
String toString() => "${super.toString()}:$COaMiIJ";
|
||||
String toString() => "${super.toString()}:COaMiIJ";
|
||||
String methodI() => "COaMiIJ:${this}.I";
|
||||
String methodJ() => "COaMiIJ:${this}.J";
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ void main() {
|
|||
Expect.type<MBC>(o);
|
||||
Expect.equals("BC&MBC", "$o");
|
||||
Expect.equals("MBC:$o.MBC", o.methodMBC());
|
||||
Expect.equals("MBC:$o.A->BC:$o.A->C:$o.A->$A:$o.A", o.methodA());
|
||||
Expect.equals("MBC:$o.A->BC:$o.A->C:$o.A->A:$o.A", o.methodA());
|
||||
Expect.equals("MBC:$o.B->BC:$o.B", o.methodB());
|
||||
Expect.equals("MBC:$o.C->BC:$o.C->C:$o.C", o.methodC());
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ void main() {
|
|||
Expect.equals("A&MAiBC&MBC", "$o");
|
||||
Expect.equals("MBC:$o.MBC", (o as MBC).methodMBC());
|
||||
Expect.equals("MAiBC:$o.MAiBC", o.methodMAiBC());
|
||||
Expect.equals("MBC:$o.A->MAiBC:$o.A->$A:$o.A", o.methodA());
|
||||
Expect.equals("MBC:$o.A->MAiBC:$o.A->A:$o.A", o.methodA());
|
||||
Expect.equals("MBC:$o.B->MAiBC:$o.B", o.methodB());
|
||||
Expect.equals("MBC:$o.C->MAiBC:$o.C", o.methodC());
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ void main() {
|
|||
Expect.type<J>(o);
|
||||
Expect.equals("BC&MBCiIJ", "$o");
|
||||
Expect.equals("MBCiIJ:$o.MBCiIJ", o.methodMBCiIJ());
|
||||
Expect.equals("MBCiIJ:$o.A->BC:$o.A->C:$o.A->$A:$o.A", o.methodA());
|
||||
Expect.equals("MBCiIJ:$o.A->BC:$o.A->C:$o.A->A:$o.A", o.methodA());
|
||||
Expect.equals("MBCiIJ:$o.B->BC:$o.B", o.methodB());
|
||||
Expect.equals("MBCiIJ:$o.C->BC:$o.C->C:$o.C", o.methodC());
|
||||
Expect.equals("MBCiIJ:$o.I", o.methodI());
|
||||
|
@ -378,7 +378,7 @@ void main() {
|
|||
Expect.equals("A&MAiBC&MBCiIJ", "$o");
|
||||
Expect.equals("MBCiIJ:$o.MBCiIJ", o.methodMBCiIJ());
|
||||
Expect.equals("MAiBC:$o.MAiBC", (o as CAaMAiBC).methodMAiBC());
|
||||
Expect.equals("MBCiIJ:$o.A->MAiBC:$o.A->$A:$o.A", o.methodA());
|
||||
Expect.equals("MBCiIJ:$o.A->MAiBC:$o.A->A:$o.A", o.methodA());
|
||||
Expect.equals("MBCiIJ:$o.B->MAiBC:$o.B", o.methodB());
|
||||
Expect.equals("MBCiIJ:$o.C->MAiBC:$o.C", o.methodC());
|
||||
Expect.equals("MBCiIJ:$o.I", o.methodI());
|
||||
|
|
Loading…
Reference in a new issue