[cfe] Account for signatures when inserting noSuchMethod forwarders

It is possible for an abstract member to be overridden with another
abstract member with different signature (that has, for example, more
optional parameters).  In such cases, the noSuchMethod forwarders should
be generated for each distinct signature.

Closes #40248.

Bug: http://dartbug.com/40248
Change-Id: I7974415f0ecb78f05d7265ecf9d57cc0d38e6c41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132661
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Dmitry Stefantsov 2020-02-04 07:58:00 +00:00 committed by commit-bot@chromium.org
parent 7c837ce30a
commit 3183573a79
27 changed files with 1115 additions and 242 deletions

View file

@ -37,6 +37,8 @@ import 'package:kernel/type_algebra.dart' show Substitution;
import 'package:kernel/type_algebra.dart' as type_algebra
show getSubstitutionMap;
import 'package:kernel/type_environment.dart';
import '../builder/builder.dart';
import '../builder/class_builder.dart';
@ -426,8 +428,9 @@ class SourceClassBuilder extends ClassBuilderImpl
library.forwardersOrigins.add(procedure);
}
void addNoSuchMethodForwarderGetterForField(Member noSuchMethod,
KernelTarget target, Field field, ClassHierarchy hierarchy) {
void addNoSuchMethodForwarderGetterForField(
Field field, Member noSuchMethod, KernelTarget target) {
ClassHierarchy hierarchy = target.loader.hierarchy;
Substitution substitution = Substitution.fromSupertype(
hierarchy.getClassAsInstanceOf(cls, field.enclosingClass));
@ -453,8 +456,9 @@ class SourceClassBuilder extends ClassBuilderImpl
getter.parent = cls;
}
void addNoSuchMethodForwarderSetterForField(Member noSuchMethod,
KernelTarget target, Field field, ClassHierarchy hierarchy) {
void addNoSuchMethodForwarderSetterForField(
Field field, Member noSuchMethod, KernelTarget target) {
ClassHierarchy hierarchy = target.loader.hierarchy;
Substitution substitution = Substitution.fromSupertype(
hierarchy.getClassAsInstanceOf(cls, field.enclosingClass));
@ -484,128 +488,212 @@ class SourceClassBuilder extends ClassBuilderImpl
setter.parent = cls;
}
/// Adds noSuchMethod forwarding stubs to this class. Returns `true` if the
/// class was modified.
bool addNoSuchMethodForwarders(
KernelTarget target, ClassHierarchy hierarchy) {
if (cls.isAbstract) return false;
bool _addMissingNoSuchMethodForwarders(
KernelTarget target, Set<Member> existingForwarders,
{bool forSetters}) {
assert(forSetters != null);
Set<Name> existingForwardersNames = new Set<Name>();
Set<Name> existingSetterForwardersNames = new Set<Name>();
Class leastConcreteSuperclass = cls.superclass;
while (
leastConcreteSuperclass != null && leastConcreteSuperclass.isAbstract) {
leastConcreteSuperclass = leastConcreteSuperclass.superclass;
}
if (leastConcreteSuperclass != null) {
bool superHasUserDefinedNoSuchMethod = hasUserDefinedNoSuchMethod(
leastConcreteSuperclass, hierarchy, target.objectClass);
List<Member> concrete =
hierarchy.getDispatchTargets(leastConcreteSuperclass);
for (Member member
in hierarchy.getInterfaceMembers(leastConcreteSuperclass)) {
if ((superHasUserDefinedNoSuchMethod ||
leastConcreteSuperclass.enclosingLibrary.compareTo(
member.enclosingClass.enclosingLibrary) !=
0 &&
member.name.isPrivate) &&
ClassHierarchy.findMemberByName(concrete, member.name) == null) {
existingForwardersNames.add(member.name);
}
}
ClassHierarchy hierarchy = target.loader.hierarchy;
TypeEnvironment typeEnvironment =
target.loader.typeInferenceEngine.typeSchemaEnvironment;
List<Member> concreteSetters =
hierarchy.getDispatchTargets(leastConcreteSuperclass, setters: true);
for (Member member in hierarchy
.getInterfaceMembers(leastConcreteSuperclass, setters: true)) {
if (ClassHierarchy.findMemberByName(concreteSetters, member.name) ==
null) {
existingSetterForwardersNames.add(member.name);
}
}
}
List<Member> allMembers =
hierarchy.getInterfaceMembers(cls, setters: forSetters);
List<Member> concreteMembers =
hierarchy.getDispatchTargets(cls, setters: forSetters);
List<Member> declaredMembers =
hierarchy.getDeclaredMembers(cls, setters: forSetters);
Member noSuchMethod = ClassHierarchy.findMemberByName(
hierarchy.getInterfaceMembers(cls), noSuchMethodName);
List<Member> concrete = hierarchy.getDispatchTargets(cls);
List<Member> declared = hierarchy.getDeclaredMembers(cls);
bool clsHasUserDefinedNoSuchMethod =
hasUserDefinedNoSuchMethod(cls, hierarchy, target.objectClass);
bool changed = false;
for (Member member in hierarchy.getInterfaceMembers(cls)) {
// We generate a noSuchMethod forwarder for [member] in [cls] if the
// following three conditions are satisfied simultaneously:
// 1) There is a user-defined noSuchMethod in [cls] or [member] is private
// and the enclosing library of [member] is different from that of
// [cls].
// 2) There is no implementation of [member] in [cls].
// 3) The superclass of [cls] has no forwarder for [member].
if (member is Procedure &&
(clsHasUserDefinedNoSuchMethod ||
cls.enclosingLibrary
.compareTo(member.enclosingClass.enclosingLibrary) !=
0 &&
member.name.isPrivate) &&
ClassHierarchy.findMemberByName(concrete, member.name) == null &&
!existingForwardersNames.contains(member.name)) {
if (ClassHierarchy.findMemberByName(declared, member.name) != null) {
transformProcedureToNoSuchMethodForwarder(
noSuchMethod, target, member);
} else {
addNoSuchMethodForwarderForProcedure(
noSuchMethod, target, member, hierarchy);
}
existingForwardersNames.add(member.name);
changed = true;
continue;
}
if (member is Field &&
ClassHierarchy.findMemberByName(concrete, member.name) == null &&
!existingForwardersNames.contains(member.name)) {
addNoSuchMethodForwarderGetterForField(
noSuchMethod, target, member, hierarchy);
existingForwardersNames.add(member.name);
changed = true;
}
// It's possible to have multiple abstract members with the same name -- as
// long as there's one with function type that's a subtype of function types
// of all other members. Such member is called "best" in the code below.
// Members with the same name are put into groups, and "best" is searched
// for in each group.
Map<Name, List<Member>> sameNameMembers = {};
for (Member member in allMembers) {
(sameNameMembers[member.name] ??= []).add(member);
}
for (Name name in sameNameMembers.keys) {
List<Member> members = sameNameMembers[name];
assert(members.isNotEmpty);
List<DartType> memberTypes = [];
List<Member> concreteSetters =
hierarchy.getDispatchTargets(cls, setters: true);
List<Member> declaredSetters =
hierarchy.getDeclaredMembers(cls, setters: true);
for (Member member in hierarchy.getInterfaceMembers(cls, setters: true)) {
if (member is Procedure &&
ClassHierarchy.findMemberByName(concreteSetters, member.name) ==
null &&
!existingSetterForwardersNames.contains(member.name)) {
if (ClassHierarchy.findMemberByName(declaredSetters, member.name) !=
null) {
transformProcedureToNoSuchMethodForwarder(
noSuchMethod, target, member);
} else {
addNoSuchMethodForwarderForProcedure(
noSuchMethod, target, member, hierarchy);
// The most specific member has the type that is subtype of the types of
// all other members.
Member bestSoFar = members.first;
DartType bestSoFarType =
forSetters ? bestSoFar.setterType : bestSoFar.getterType;
bestSoFarType = Substitution.fromSupertype(
hierarchy.getClassAsInstanceOf(cls, bestSoFar.enclosingClass))
.substituteType(bestSoFarType);
for (int i = 1; i < members.length; ++i) {
Member candidate = members[i];
DartType candidateType =
forSetters ? candidate.setterType : candidate.getterType;
Substitution substitution = Substitution.fromSupertype(
hierarchy.getClassAsInstanceOf(cls, candidate.enclosingClass));
candidateType = substitution.substituteType(candidateType);
memberTypes.add(candidateType);
bool isMoreSpecific = forSetters
? typeEnvironment.isSubtypeOf(bestSoFarType, candidateType,
SubtypeCheckMode.withNullabilities)
: typeEnvironment.isSubtypeOf(candidateType, bestSoFarType,
SubtypeCheckMode.withNullabilities);
if (isMoreSpecific) {
bestSoFar = candidate;
bestSoFarType = candidateType;
}
existingSetterForwardersNames.add(member.name);
changed = true;
}
if (member is Field &&
ClassHierarchy.findMemberByName(concreteSetters, member.name) ==
null &&
!existingSetterForwardersNames.contains(member.name)) {
addNoSuchMethodForwarderSetterForField(
noSuchMethod, target, member, hierarchy);
existingSetterForwardersNames.add(member.name);
changed = true;
// Since isSubtypeOf isn't a linear order on types, we need to check once
// again that the found member is indeed the most specific one.
bool isActuallyBestSoFar = true;
for (DartType memberType in memberTypes) {
bool isMoreSpecific = forSetters
? typeEnvironment.isSubtypeOf(
memberType, bestSoFarType, SubtypeCheckMode.withNullabilities)
: typeEnvironment.isSubtypeOf(
bestSoFarType, memberType, SubtypeCheckMode.withNullabilities);
if (!isMoreSpecific) {
isActuallyBestSoFar = false;
break;
}
}
if (!isActuallyBestSoFar) {
// It's a member conflict that is reported elsewhere.
} else {
Member member = bestSoFar;
if (_isForwarderRequired(
clsHasUserDefinedNoSuchMethod, member, cls, concreteMembers,
isPatch: member.fileUri != member.enclosingClass.fileUri) &&
!existingForwarders.contains(member)) {
if (member is Procedure) {
// If there's a declared member with such name, then it's abstract
// -- transform it into a noSuchMethod forwarder.
if (ClassHierarchy.findMemberByName(declaredMembers, member.name) !=
null) {
transformProcedureToNoSuchMethodForwarder(
noSuchMethod, target, member);
} else {
addNoSuchMethodForwarderForProcedure(
noSuchMethod, target, member, hierarchy);
}
changed = true;
} else if (member is Field) {
// Current class isn't abstract, so it can't have an abstract field
// with the same name -- just insert the forwarder.
if (forSetters) {
addNoSuchMethodForwarderSetterForField(
member, noSuchMethod, target);
} else {
addNoSuchMethodForwarderGetterForField(
member, noSuchMethod, target);
}
changed = true;
} else {
return unhandled(
"${member.runtimeType}",
"addNoSuchMethodForwarders",
cls.fileOffset,
cls.enclosingLibrary.fileUri);
}
}
}
}
return changed;
}
/// Adds noSuchMethod forwarding stubs to this class.
///
/// Returns `true` if the class was modified.
bool addNoSuchMethodForwarders(
KernelTarget target, ClassHierarchy hierarchy) {
// Don't install forwarders in superclasses.
if (cls.isAbstract) return false;
// Compute signatures of existing noSuchMethod forwarders in superclasses.
Set<Member> existingForwarders = new Set<Member>.identity();
Set<Member> existingSetterForwarders = new Set<Member>.identity();
{
Class nearestConcreteSuperclass = cls.superclass;
while (nearestConcreteSuperclass != null &&
nearestConcreteSuperclass.isAbstract) {
nearestConcreteSuperclass = nearestConcreteSuperclass.superclass;
}
if (nearestConcreteSuperclass != null) {
bool superHasUserDefinedNoSuchMethod = hasUserDefinedNoSuchMethod(
nearestConcreteSuperclass, hierarchy, target.objectClass);
{
List<Member> concrete =
hierarchy.getDispatchTargets(nearestConcreteSuperclass);
for (Member member
in hierarchy.getInterfaceMembers(nearestConcreteSuperclass)) {
if (_isForwarderRequired(superHasUserDefinedNoSuchMethod, member,
nearestConcreteSuperclass, concrete,
isPatch: member.fileUri != member.enclosingClass.fileUri)) {
existingForwarders.add(member);
}
}
}
{
List<Member> concreteSetters = hierarchy
.getDispatchTargets(nearestConcreteSuperclass, setters: true);
for (Member member in hierarchy
.getInterfaceMembers(nearestConcreteSuperclass, setters: true)) {
if (_isForwarderRequired(superHasUserDefinedNoSuchMethod, member,
nearestConcreteSuperclass, concreteSetters)) {
existingSetterForwarders.add(member);
}
}
}
}
}
bool changed = false;
// Install noSuchMethod forwarders for methods and getters.
changed = _addMissingNoSuchMethodForwarders(target, existingForwarders,
forSetters: false) ||
changed;
// Install noSuchMethod forwarders for setters.
changed = _addMissingNoSuchMethodForwarders(
target, existingSetterForwarders,
forSetters: true) ||
changed;
return changed;
}
/// Tells if a noSuchMethod forwarder is required for [member] in [cls].
bool _isForwarderRequired(bool hasUserDefinedNoSuchMethod, Member member,
Class cls, List<Member> concreteMembers,
{bool isPatch = false}) {
// A noSuchMethod forwarder is allowed for an abstract member if the class
// has a user-defined noSuchMethod or if the member is private and is
// defined in a different library. Private members in patches are assumed
// to be visible only to patches, so they are treated as if they were from
// another library.
bool isForwarderAllowed = hasUserDefinedNoSuchMethod ||
(member.name.isPrivate &&
cls.enclosingLibrary.compareTo(member.enclosingLibrary) != 0) ||
(member.name.isPrivate && isPatch);
// A noSuchMethod forwarder is required if it's allowed and if there's no
// concrete implementation or a forwarder already.
bool isForwarderRequired = isForwarderAllowed &&
ClassHierarchy.findMemberByName(concreteMembers, member.name) == null;
return isForwarderRequired;
}
void addRedirectingConstructor(ProcedureBuilder constructorBuilder,
SourceLibraryBuilder library, Field referenceFrom) {
// Add a new synthetic field to this class for representing factory

View file

@ -392,6 +392,7 @@ case
cased
cases
casting
cat
catch
catches
categories
@ -903,6 +904,7 @@ early
easier
easiest
easily
eat
edge
edges
edit
@ -1160,6 +1162,7 @@ flatten
flattened
flexibility
flexible
float
flow
flow's
flush
@ -1173,6 +1176,7 @@ follow
followed
following
follows
food
for
force
forced
@ -1335,6 +1339,7 @@ hostnames
how
however
http
hungry
hybrid
idea
ideally
@ -2219,6 +2224,7 @@ promotion
promotions
propagate
propagating
propagation
proper
properly
properties

View file

@ -37,6 +37,7 @@ b0x
b1x
b2x
ba
baba
backed
bailout
bash

View file

@ -185,14 +185,6 @@ class MyClass extends self::B {
;
method cMethod() → dynamic
;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#property3=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set property1(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#property1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
class MyMock1 extends self::B {
synthetic constructor •() → self::MyMock1*
@ -225,16 +217,6 @@ class MyMock3 extends self::B {
synthetic constructor •() → self::MyMock3*
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#property3=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#property1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#property2=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
class C extends core::Object {
synthetic constructor •() → self::C*

View file

@ -181,14 +181,6 @@ class MyClass extends self::B {
method aMethod() → dynamic {}
method bMethod() → dynamic {}
method cMethod() → dynamic {}
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
class MyMock1 extends self::B {
synthetic constructor •() → self::MyMock1*
@ -197,19 +189,19 @@ class MyMock1 extends self::B {
method noSuchMethod(core::Invocation* _) → dynamic
return null;
no-such-method-forwarder method interfaceMethod2() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method abstractMethod() → dynamic
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder method interfaceMethod1() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method abstractMethod() → dynamic
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder method interfaceMethod1() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method interfaceMethod3() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
@ -224,16 +216,6 @@ class MyMock3 extends self::B {
: super self::B::•()
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
class C extends core::Object {
synthetic constructor •() → self::C*
@ -296,15 +278,15 @@ abstract class J extends self::I implements self::Bar {
static method main() → dynamic {}
constants {
#C1 = #interfaceMethod1
#C1 = #interfaceMethod2
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #property3=
#C6 = #interfaceMethod1=
#C7 = #property1=
#C8 = #interfaceMethod2
#C9 = #abstractMethod
#C10 = #interfaceMethod3
#C5 = #abstractMethod
#C6 = #interfaceMethod1
#C7 = #interfaceMethod3
#C8 = #property3=
#C9 = #interfaceMethod1=
#C10 = #property1=
#C11 = #property2=
}

View file

@ -185,14 +185,6 @@ class MyClass extends self::B {
;
method cMethod() → dynamic
;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#property3=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set property1(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#property1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
class MyMock1 extends self::B {
synthetic constructor •() → self::MyMock1*
@ -225,16 +217,6 @@ class MyMock3 extends self::B {
synthetic constructor •() → self::MyMock3*
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#property3=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#interfaceMethod1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#property1=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#property2=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
class C extends core::Object {
synthetic constructor •() → self::C*

View file

@ -181,14 +181,6 @@ class MyClass extends self::B {
method aMethod() → dynamic {}
method bMethod() → dynamic {}
method cMethod() → dynamic {}
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
class MyMock1 extends self::B {
synthetic constructor •() → self::MyMock1*
@ -197,19 +189,19 @@ class MyMock1 extends self::B {
method noSuchMethod(core::Invocation* _) → dynamic
return null;
no-such-method-forwarder method interfaceMethod2() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method abstractMethod() → dynamic
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder method interfaceMethod1() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method abstractMethod() → dynamic
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder method interfaceMethod1() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method interfaceMethod3() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
@ -224,16 +216,6 @@ class MyMock3 extends self::B {
: super self::B::•()
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
class C extends core::Object {
synthetic constructor •() → self::C*
@ -296,15 +278,15 @@ abstract class J extends self::I implements self::Bar {
static method main() → dynamic {}
constants {
#C1 = #interfaceMethod1
#C1 = #interfaceMethod2
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #property3=
#C6 = #interfaceMethod1=
#C7 = #property1=
#C8 = #interfaceMethod2
#C9 = #abstractMethod
#C10 = #interfaceMethod3
#C5 = #abstractMethod
#C6 = #interfaceMethod1
#C7 = #interfaceMethod3
#C8 = #property3=
#C9 = #interfaceMethod1=
#C10 = #property1=
#C11 = #property2=
}

View file

@ -181,14 +181,6 @@ class MyClass extends self::B {
method aMethod() → dynamic {}
method bMethod() → dynamic {}
method cMethod() → dynamic {}
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
class MyMock1 extends self::B {
synthetic constructor •() → self::MyMock1*
@ -197,19 +189,19 @@ class MyMock1 extends self::B {
method noSuchMethod(core::Invocation* _) → dynamic
return null;
no-such-method-forwarder method interfaceMethod2() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method abstractMethod() → dynamic
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder method interfaceMethod1() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method abstractMethod() → dynamic
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder method interfaceMethod1() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder method interfaceMethod3() → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 0, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C8, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock1::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
@ -224,16 +216,6 @@ class MyMock3 extends self::B {
: super self::B::•()
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
no-such-method-forwarder get interfaceMethod1() → dynamic
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} dynamic;
no-such-method-forwarder set property3(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set interfaceMethod1(dynamic value) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property1(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C7, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set property2(dynamic _) → void
return this.{self::MyMock3::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[_]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
class C extends core::Object {
synthetic constructor •() → self::C*
@ -296,15 +278,15 @@ abstract class J extends self::I implements self::Bar {
static method main() → dynamic {}
constants {
#C1 = #interfaceMethod1
#C1 = #interfaceMethod2
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #property3=
#C6 = #interfaceMethod1=
#C7 = #property1=
#C8 = #interfaceMethod2
#C9 = #abstractMethod
#C10 = #interfaceMethod3
#C5 = #abstractMethod
#C6 = #interfaceMethod1
#C7 = #interfaceMethod3
#C8 = #property3=
#C9 = #interfaceMethod1=
#C10 = #property1=
#C11 = #property2=
}

View file

@ -0,0 +1,42 @@
// Copyright (c) 2020, 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.
// This is a regression test for http://dartbug.com/40248.
class Base {
set push(int x);
set float(covariant int x);
noSuchMethod(i) => print("${runtimeType}: ${i.positionalArguments[0]}");
}
class Me extends Base {}
class You extends Base {
set push(num x);
set float(num x);
}
main() {
List<Base> list = [Me(), You()];
for (Base baba in list) {
baba.push = 0;
baba.float = 1;
if (baba is You) {
baba.push = 2.3;
baba.float = 4.5;
}
try {
(baba as dynamic).push = 6.7;
baba is You || (throw "Fail!");
} on TypeError {
baba is Me || (throw "Fail!");
}
try {
(baba as dynamic).float = 8.9;
baba is You || (throw "Fail!");
} on TypeError {
baba is Me || (throw "Fail!");
}
}
}

View file

@ -0,0 +1,28 @@
library;
import self as self;
import "dart:core" as core;
class Base extends core::Object {
synthetic constructor •() → self::Base*
;
no-such-method-forwarder set push(core::int* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#push=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set float(covariant core::int* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#float=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
method noSuchMethod(core::Invocation* i) → dynamic
;
}
class Me extends self::Base {
synthetic constructor •() → self::Me*
;
}
class You extends self::Base {
synthetic constructor •() → self::You*
;
no-such-method-forwarder set push(core::num* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#push=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set float(covariant core::num* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#float=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
static method main() → dynamic
;

View file

@ -0,0 +1,62 @@
library;
import self as self;
import "dart:core" as core;
class Base extends core::Object {
synthetic constructor •() → self::Base*
: super core::Object::•()
;
no-such-method-forwarder set push(core::int* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set float(covariant core::int* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
method noSuchMethod(core::Invocation* i) → dynamic
return core::print("${this.{core::Object::runtimeType}}: ${i.{core::Invocation::positionalArguments}.{core::List::[]}(0)}");
}
class Me extends self::Base {
synthetic constructor •() → self::Me*
: super self::Base::•()
;
}
class You extends self::Base {
synthetic constructor •() → self::You*
: super self::Base::•()
;
no-such-method-forwarder set push(core::num* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set float(covariant core::num* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
static method main() → dynamic {
core::List<self::Base*>* list = <self::Base*>[new self::Me::•(), new self::You::•()];
for (self::Base* baba in list) {
baba.{self::Base::push} = 0;
baba.{self::Base::float} = 1;
if(baba is self::You*) {
baba{self::You*}.{self::You::push} = 2.3;
baba{self::You*}.{self::You::float} = 4.5;
}
try {
(baba as dynamic).push = 6.7;
baba is self::You* || (throw "Fail!");
}
on core::TypeError* catch(no-exception-var) {
baba is self::Me* || (throw "Fail!");
}
try {
(baba as dynamic).float = 8.9;
baba is self::You* || (throw "Fail!");
}
on core::TypeError* catch(no-exception-var) {
baba is self::Me* || (throw "Fail!");
}
}
}
constants {
#C1 = #push=
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #float=
}

View file

@ -0,0 +1,69 @@
library;
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
class Base extends core::Object {
synthetic constructor •() → self::Base*
: super core::Object::•()
;
no-such-method-forwarder set push(core::int* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set float(covariant core::int* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
method noSuchMethod(core::Invocation* i) → dynamic
return core::print("${this.{core::Object::runtimeType}}: ${i.{core::Invocation::positionalArguments}.{core::List::[]}(0)}");
}
class Me extends self::Base {
synthetic constructor •() → self::Me*
: super self::Base::•()
;
}
class You extends self::Base {
synthetic constructor •() → self::You*
: super self::Base::•()
;
no-such-method-forwarder set push(core::num* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
no-such-method-forwarder set float(covariant core::num* x) → void
return this.{self::Base::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
static method main() → dynamic {
core::List<self::Base*>* list = <self::Base*>[new self::Me::•(), new self::You::•()];
{
core::Iterator<self::Base*>* :sync-for-iterator = _in::unsafeCast<core::Iterable<self::Base*>*>(list).{core::Iterable::iterator};
for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
self::Base* baba = :sync-for-iterator.{core::Iterator::current};
{
baba.{self::Base::push} = 0;
baba.{self::Base::float} = 1;
if(baba is self::You*) {
baba{self::You*}.{self::You::push} = 2.3;
baba{self::You*}.{self::You::float} = 4.5;
}
try {
(baba as dynamic).push = 6.7;
baba is self::You* || (throw "Fail!");
}
on core::TypeError* catch(no-exception-var) {
baba is self::Me* || (throw "Fail!");
}
try {
(baba as dynamic).float = 8.9;
baba is self::You* || (throw "Fail!");
}
on core::TypeError* catch(no-exception-var) {
baba is self::Me* || (throw "Fail!");
}
}
}
}
}
constants {
#C1 = #push=
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #float=
}

View file

@ -0,0 +1,32 @@
// Copyright (c) 2020, 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.
// This is a regression test for http://dartbug.com/40248.
class Cat {
bool eatFood(String food) => true;
}
class MockCat implements Cat {
dynamic noSuchMethod(Invocation invocation) {
var arg = invocation.positionalArguments[0];
return arg is String && arg.isNotEmpty;
}
}
class MockCat2 extends MockCat {
noSuchMethod(_);
}
class MockCat3 extends MockCat2 implements Cat {
bool eatFood(String food, {double amount});
}
class MockCat4 extends MockCat2 implements HungryCat {}
abstract class HungryCat {
bool eatFood(String food, {double amount, double yetAnother});
}
main() {}

View file

@ -0,0 +1,42 @@
library;
import self as self;
import "dart:core" as core;
class Cat extends core::Object {
synthetic constructor •() → self::Cat*
;
method eatFood(core::String* food) → core::bool*
;
}
class MockCat extends core::Object implements self::Cat {
synthetic constructor •() → self::MockCat*
;
method noSuchMethod(core::Invocation* invocation) → dynamic
;
no-such-method-forwarder method eatFood(core::String* food) → core::bool*
return this.{self::MockCat::noSuchMethod}(new core::_InvocationMirror::_withType(#eatFood, 0, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} core::bool*;
}
class MockCat2 extends self::MockCat {
synthetic constructor •() → self::MockCat2*
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
}
class MockCat3 extends self::MockCat2 implements self::Cat {
synthetic constructor •() → self::MockCat3*
;
no-such-method-forwarder method eatFood(core::String* food, {core::double* amount}) → core::bool*
return this.{self::MockCat2::noSuchMethod}(new core::_InvocationMirror::_withType(#eatFood, 0, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#amount: amount}))) as{TypeError,ForDynamic} core::bool*;
}
class MockCat4 extends self::MockCat2 implements self::HungryCat {
synthetic constructor •() → self::MockCat4*
;
no-such-method-forwarder method eatFood(core::String* food, {core::double* amount, core::double* yetAnother}) → core::bool*
return this.{self::MockCat2::noSuchMethod}(new core::_InvocationMirror::_withType(#eatFood, 0, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#amount: amount, #yetAnother: yetAnother}))) as{TypeError,ForDynamic} core::bool*;
}
abstract class HungryCat extends core::Object {
synthetic constructor •() → self::HungryCat*
;
abstract method eatFood(core::String* food, {core::double* amount, core::double* yetAnother}) → core::bool*;
}
static method main() → dynamic
;

View file

@ -0,0 +1,59 @@
library;
import self as self;
import "dart:core" as core;
class Cat extends core::Object {
synthetic constructor •() → self::Cat*
: super core::Object::•()
;
method eatFood(core::String* food) → core::bool*
return true;
}
class MockCat extends core::Object implements self::Cat {
synthetic constructor •() → self::MockCat*
: super core::Object::•()
;
method noSuchMethod(core::Invocation* invocation) → dynamic {
dynamic arg = invocation.{core::Invocation::positionalArguments}.{core::List::[]}(0);
return arg is core::String* && arg{core::String*}.{core::String::isNotEmpty};
}
no-such-method-forwarder method eatFood(core::String* food) → core::bool*
return this.{self::MockCat::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} core::bool*;
}
class MockCat2 extends self::MockCat {
synthetic constructor •() → self::MockCat2*
: super self::MockCat::•()
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
}
class MockCat3 extends self::MockCat2 implements self::Cat {
synthetic constructor •() → self::MockCat3*
: super self::MockCat2::•()
;
no-such-method-forwarder method eatFood(core::String* food, {core::double* amount = #C5}) → core::bool*
return this.{self::MockCat2::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C6: amount}))) as{TypeError,ForDynamic} core::bool*;
}
class MockCat4 extends self::MockCat2 implements self::HungryCat {
synthetic constructor •() → self::MockCat4*
: super self::MockCat2::•()
;
no-such-method-forwarder method eatFood(core::String* food, {core::double* amount = #C5, core::double* yetAnother = #C5}) → core::bool*
return this.{self::MockCat2::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C6: amount, #C7: yetAnother}))) as{TypeError,ForDynamic} core::bool*;
}
abstract class HungryCat extends core::Object {
synthetic constructor •() → self::HungryCat*
: super core::Object::•()
;
abstract method eatFood(core::String* food, {core::double* amount = #C5, core::double* yetAnother = #C5}) → core::bool*;
}
static method main() → dynamic {}
constants {
#C1 = #eatFood
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = null
#C6 = #amount
#C7 = #yetAnother
}

View file

@ -0,0 +1,59 @@
library;
import self as self;
import "dart:core" as core;
class Cat extends core::Object {
synthetic constructor •() → self::Cat*
: super core::Object::•()
;
method eatFood(core::String* food) → core::bool*
return true;
}
class MockCat extends core::Object implements self::Cat {
synthetic constructor •() → self::MockCat*
: super core::Object::•()
;
method noSuchMethod(core::Invocation* invocation) → dynamic {
dynamic arg = invocation.{core::Invocation::positionalArguments}.{core::List::[]}(0);
return arg is core::String* && arg{core::String*}.{core::String::isNotEmpty};
}
no-such-method-forwarder method eatFood(core::String* food) → core::bool*
return this.{self::MockCat::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} core::bool*;
}
class MockCat2 extends self::MockCat {
synthetic constructor •() → self::MockCat2*
: super self::MockCat::•()
;
abstract method noSuchMethod(core::Invocation* _) → dynamic;
}
class MockCat3 extends self::MockCat2 implements self::Cat {
synthetic constructor •() → self::MockCat3*
: super self::MockCat2::•()
;
no-such-method-forwarder method eatFood(core::String* food, {core::double* amount = #C5}) → core::bool*
return this.{self::MockCat2::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C6: amount}))) as{TypeError,ForDynamic} core::bool*;
}
class MockCat4 extends self::MockCat2 implements self::HungryCat {
synthetic constructor •() → self::MockCat4*
: super self::MockCat2::•()
;
no-such-method-forwarder method eatFood(core::String* food, {core::double* amount = #C5, core::double* yetAnother = #C5}) → core::bool*
return this.{self::MockCat2::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 0, #C2, core::List::unmodifiable<dynamic>(<dynamic>[food]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C6: amount, #C7: yetAnother}))) as{TypeError,ForDynamic} core::bool*;
}
abstract class HungryCat extends core::Object {
synthetic constructor •() → self::HungryCat*
: super core::Object::•()
;
abstract method eatFood(core::String* food, {core::double* amount = #C5, core::double* yetAnother = #C5}) → core::bool*;
}
static method main() → dynamic {}
constants {
#C1 = #eatFood
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = null
#C6 = #amount
#C7 = #yetAnother
}

View file

@ -0,0 +1,26 @@
// Copyright (c) 2020, 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.
// The test checks that the noSuchMethod forwarders inserted into a class aren't
// re-inserted in its children.
import './forwarder_propagation_lib.dart';
abstract class A {
void set foo(int value);
int get bar;
void baz(int x, {String y, double z});
}
class B implements A {
noSuchMethod(_) {}
}
class C extends B {}
class E implements D {}
class F extends E {}
main() {}

View file

@ -0,0 +1,63 @@
library;
import self as self;
import "dart:core" as core;
import "forwarder_propagation_lib.dart" as for;
import "org-dartlang-testcase:///forwarder_propagation_lib.dart";
abstract class A extends core::Object {
synthetic constructor •() → self::A*
;
abstract set foo(core::int* value) → void;
abstract get bar() → core::int*;
abstract method baz(core::int* x, {core::String* y, core::double* z}) → void;
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B*
;
method noSuchMethod(core::Invocation* _) → dynamic
;
no-such-method-forwarder get bar() → core::int*
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#bar, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder method baz(core::int* x, {core::String* y, core::double* z}) → void
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#baz, 0, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#y: y, #z: z})));
no-such-method-forwarder set foo(core::int* value) → void
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#foo=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
class C extends self::B {
synthetic constructor •() → self::C*
;
}
class E extends core::Object implements for::D {
synthetic constructor •() → self::E*
;
no-such-method-forwarder get /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateGetter() → core::int*
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_privateGetter, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder get /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateField() → core::int*
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_privateField, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder method /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateMethod() → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_privateMethod, 0, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateSetter(core::int* value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_privateSetter=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
no-such-method-forwarder set /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateField(core::int* value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#_privateField=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
class F extends self::E {
synthetic constructor •() → self::F*
;
}
static method main() → dynamic
;
library;
import self as for;
import "dart:core" as core;
abstract class D extends core::Object {
field core::int* _privateField;
synthetic constructor •() → for::D*
;
abstract get _privateGetter() → core::int*;
abstract set _privateSetter(core::int* value) → void;
abstract method _privateMethod() → void;
}

View file

@ -0,0 +1,84 @@
library;
import self as self;
import "dart:core" as core;
import "forwarder_propagation_lib.dart" as for;
import "org-dartlang-testcase:///forwarder_propagation_lib.dart";
abstract class A extends core::Object {
synthetic constructor •() → self::A*
: super core::Object::•()
;
abstract set foo(core::int* value) → void;
abstract get bar() → core::int*;
abstract method baz(core::int* x, {core::String* y = #C1, core::double* z = #C1}) → void;
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B*
: super core::Object::•()
;
method noSuchMethod(core::Invocation* _) → dynamic {}
no-such-method-forwarder get bar() → core::int*
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 1, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder method baz(core::int* x, {core::String* y = #C1, core::double* z = #C1}) → void
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C3, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C7: y, #C8: z})));
no-such-method-forwarder set foo(core::int* value) → void
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 2, #C3, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
}
class C extends self::B {
synthetic constructor •() → self::C*
: super self::B::•()
;
}
class E extends core::Object implements for::D {
synthetic constructor •() → self::E*
: super core::Object::•()
;
no-such-method-forwarder get /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateGetter() → core::int*
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 1, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder get /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateField() → core::int*
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 1, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder method /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateMethod() → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C12, 0, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
no-such-method-forwarder set /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateSetter(core::int* value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C13, 2, #C3, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
no-such-method-forwarder set /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateField(core::int* value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C14, 2, #C3, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
}
class F extends self::E {
synthetic constructor •() → self::F*
: super self::E::•()
;
}
static method main() → dynamic {}
library;
import self as for;
import "dart:core" as core;
abstract class D extends core::Object {
field core::int* _privateField = null;
synthetic constructor •() → for::D*
: super core::Object::•()
;
abstract get _privateGetter() → core::int*;
abstract set _privateSetter(core::int* value) → void;
abstract method _privateMethod() → void;
}
constants {
#C1 = null
#C2 = #bar
#C3 = <core::Type*>[]
#C4 = <dynamic>[]
#C5 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C4}
#C6 = #baz
#C7 = #y
#C8 = #z
#C9 = #foo=
#C10 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateGetter
#C11 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateField
#C12 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateMethod
#C13 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateSetter=
#C14 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateField=
}

View file

@ -0,0 +1,84 @@
library;
import self as self;
import "dart:core" as core;
import "forwarder_propagation_lib.dart" as for;
import "org-dartlang-testcase:///forwarder_propagation_lib.dart";
abstract class A extends core::Object {
synthetic constructor •() → self::A*
: super core::Object::•()
;
abstract set foo(core::int* value) → void;
abstract get bar() → core::int*;
abstract method baz(core::int* x, {core::String* y = #C1, core::double* z = #C1}) → void;
}
class B extends core::Object implements self::A {
synthetic constructor •() → self::B*
: super core::Object::•()
;
method noSuchMethod(core::Invocation* _) → dynamic {}
no-such-method-forwarder get bar() → core::int*
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#C2, 1, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder method baz(core::int* x, {core::String* y = #C1, core::double* z = #C1}) → void
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#C6, 0, #C3, core::List::unmodifiable<dynamic>(<dynamic>[x]), core::Map::unmodifiable<core::Symbol*, dynamic>(<core::Symbol*, dynamic>{#C7: y, #C8: z})));
no-such-method-forwarder set foo(core::int* value) → void
return this.{self::B::noSuchMethod}(new core::_InvocationMirror::_withType(#C9, 2, #C3, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
}
class C extends self::B {
synthetic constructor •() → self::C*
: super self::B::•()
;
}
class E extends core::Object implements for::D {
synthetic constructor •() → self::E*
: super core::Object::•()
;
no-such-method-forwarder get /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateGetter() → core::int*
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C10, 1, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder get /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateField() → core::int*
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C11, 1, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5))) as{TypeError,ForDynamic} core::int*;
no-such-method-forwarder method /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateMethod() → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C12, 0, #C3, #C4, core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
no-such-method-forwarder set /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateSetter(core::int* value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C13, 2, #C3, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
no-such-method-forwarder set /* from org-dartlang-testcase:///forwarder_propagation_lib.dart */ _privateField(core::int* value) → void
return this.{core::Object::noSuchMethod}(new core::_InvocationMirror::_withType(#C14, 2, #C3, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C5)));
}
class F extends self::E {
synthetic constructor •() → self::F*
: super self::E::•()
;
}
static method main() → dynamic {}
library;
import self as for;
import "dart:core" as core;
abstract class D extends core::Object {
field core::int* _privateField = null;
synthetic constructor •() → for::D*
: super core::Object::•()
;
abstract get _privateGetter() → core::int*;
abstract set _privateSetter(core::int* value) → void;
abstract method _privateMethod() → void;
}
constants {
#C1 = null
#C2 = #bar
#C3 = <core::Type*>[]
#C4 = <dynamic>[]
#C5 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C4}
#C6 = #baz
#C7 = #y
#C8 = #z
#C9 = #foo=
#C10 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateGetter
#C11 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateField
#C12 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateMethod
#C13 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateSetter=
#C14 = #org-dartlang-testcase:///forwarder_propagation.dart::_privateField=
}

View file

@ -0,0 +1,10 @@
// Copyright (c) 2020, 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.
abstract class D {
int _privateField;
int get _privateGetter;
void set _privateSetter(int value);
void _privateMethod();
}

View file

@ -0,0 +1,24 @@
// Copyright (c) 2020, 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.
class A {
void set foo(int value) {}
int get bar => null;
}
class B {
void set foo(double value) {}
double get bar => null;
}
class C {
void set foo(num value) {}
Null get bar => null;
}
class D implements C, A, B {
noSuchMethod(_) => null;
}
main() {}

View file

@ -0,0 +1,40 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A*
;
set foo(core::int* value) → void
;
get bar() → core::int*
;
}
class B extends core::Object {
synthetic constructor •() → self::B*
;
set foo(core::double* value) → void
;
get bar() → core::double*
;
}
class C extends core::Object {
synthetic constructor •() → self::C*
;
set foo(core::num* value) → void
;
get bar() → core::Null?
;
}
class D extends core::Object implements self::C, self::A, self::B {
synthetic constructor •() → self::D*
;
method noSuchMethod(core::Invocation* _) → dynamic
;
no-such-method-forwarder get bar() → core::Null?
return this.{self::D::noSuchMethod}(new core::_InvocationMirror::_withType(#bar, 1, const <core::Type*>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{}))) as{TypeError,ForDynamic} core::Null?;
no-such-method-forwarder set foo(core::num* value) → void
return this.{self::D::noSuchMethod}(new core::_InvocationMirror::_withType(#foo=, 2, const <core::Type*>[], core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(const <core::Symbol*, dynamic>{})));
}
static method main() → dynamic
;

View file

@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A*
: super core::Object::•()
;
set foo(core::int* value) → void {}
get bar() → core::int*
return null;
}
class B extends core::Object {
synthetic constructor •() → self::B*
: super core::Object::•()
;
set foo(core::double* value) → void {}
get bar() → core::double*
return null;
}
class C extends core::Object {
synthetic constructor •() → self::C*
: super core::Object::•()
;
set foo(core::num* value) → void {}
get bar() → core::Null?
return null;
}
class D extends core::Object implements self::C, self::A, self::B {
synthetic constructor •() → self::D*
: super core::Object::•()
;
method noSuchMethod(core::Invocation* _) → dynamic
return null;
no-such-method-forwarder get bar() → core::Null?
return this.{self::D::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} core::Null?;
no-such-method-forwarder set foo(core::num* value) → void
return this.{self::D::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
static method main() → dynamic {}
constants {
#C1 = #bar
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #foo=
}

View file

@ -0,0 +1,48 @@
library;
import self as self;
import "dart:core" as core;
class A extends core::Object {
synthetic constructor •() → self::A*
: super core::Object::•()
;
set foo(core::int* value) → void {}
get bar() → core::int*
return null;
}
class B extends core::Object {
synthetic constructor •() → self::B*
: super core::Object::•()
;
set foo(core::double* value) → void {}
get bar() → core::double*
return null;
}
class C extends core::Object {
synthetic constructor •() → self::C*
: super core::Object::•()
;
set foo(core::num* value) → void {}
get bar() → core::Null?
return null;
}
class D extends core::Object implements self::C, self::A, self::B {
synthetic constructor •() → self::D*
: super core::Object::•()
;
method noSuchMethod(core::Invocation* _) → dynamic
return null;
no-such-method-forwarder get bar() → core::Null?
return this.{self::D::noSuchMethod}(new core::_InvocationMirror::_withType(#C1, 1, #C2, #C3, core::Map::unmodifiable<core::Symbol*, dynamic>(#C4))) as{TypeError,ForDynamic} core::Null?;
no-such-method-forwarder set foo(core::num* value) → void
return this.{self::D::noSuchMethod}(new core::_InvocationMirror::_withType(#C5, 2, #C2, core::List::unmodifiable<dynamic>(<dynamic>[value]), core::Map::unmodifiable<core::Symbol*, dynamic>(#C4)));
}
static method main() → dynamic {}
constants {
#C1 = #bar
#C2 = <core::Type*>[]
#C3 = <dynamic>[]
#C4 = core::_ImmutableMap<core::Symbol*, dynamic> {_kvPairs:#C3}
#C5 = #foo=
}

View file

@ -1273,12 +1273,16 @@ no_such_method_forwarders/abstract_accessors_from_field_arent_mixed_in: TextSeri
no_such_method_forwarders/abstract_accessors_from_field_one_defined: TextSerializationFailure # Was: Pass
no_such_method_forwarders/abstract_accessors_from_field_with_substitution: TextSerializationFailure # Was: Pass
no_such_method_forwarders/abstract_interface_nsm_inherited: TextSerializationFailure # Was: Pass
no_such_method_forwarders/abstract_override_abstract_different_type: TextSerializationFailure
no_such_method_forwarders/abstract_override_with_different_signature: TextSerializationFailure
no_such_method_forwarders/concrete_method_over_forwarder_in_mixin_application: TextSerializationFailure # Was: Pass
no_such_method_forwarders/default_argument_values: TextSerializationFailure # Was: Pass
no_such_method_forwarders/duplicated_abstract_method: TextSerializationFailure # Was: Pass
no_such_method_forwarders/forwarder_propagation: TextSerializationFailure
no_such_method_forwarders/forwarders_not_assumed_from_mixin: TextSerializationFailure # Was: Pass
no_such_method_forwarders/interface_with_concrete: TextSerializationFailure # Was: Pass
no_such_method_forwarders/interface_with_nsm: TextSerializationFailure # Was: Pass
no_such_method_forwarders/multiple_abstract_setters: TextSerializationFailure
no_such_method_forwarders/no_forwarders_for_abstract_classes: TextSerializationFailure # Was: Pass
no_such_method_forwarders/no_forwarders_for_abstract_classes_chain: TextSerializationFailure # Was: Pass
no_such_method_forwarders/nsm_inherited: TextSerializationFailure # Was: Pass

View file

@ -0,0 +1,44 @@
// 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.
// This is a regression test for http://dartbug.com/40248.
import "package:expect/expect.dart";
class Base {
set push(int x);
set float(covariant int x);
noSuchMethod(i) => print("${runtimeType}: ${i.positionalArguments[0]}");
}
class Me extends Base {}
class You extends Base {
set push(num x);
set float(num x);
}
main() {
List<Base> list = [Me(), You()];
for (Base baba in list) {
baba.push = 0;
baba.float = 1;
if (baba is You) {
baba.push = 2.3;
baba.float = 4.5;
}
try {
(baba as dynamic).push = 6.7;
Expect.isTrue(baba is You);
} on TypeError {
Expect.isTrue(baba is Me);
}
try {
(baba as dynamic).float = 8.9;
Expect.isTrue(baba is You);
} on TypeError {
Expect.isTrue(baba is Me);
}
}
}