You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example below, given multiple candidate instances of OuterInterface to use as InnerInterface's outer, the wrong one is chosen. The most refined class should be used to as the starting point to determine the outer instance for an interface (working outward), whereas it appears the topmost satisfying class is used as the starting point (also working outward).
An instance of OuterClass should serve as InnerInterface.outer for instances of MiddleClass. This works.
But, an instance of MiddleClass should serve as InnerInterface.outer for instances of InnerClass. This does not seem to be working.
sharedvoidrun() {
interfaceOuterInterface<outT> {
shareddefaultStringouterInterfaceT => "OuterInterface.T = " + `T`.string;
shareddefaultStringouterInterfaceIdent => "OuterInterface.ident, OuterInterface impl";
sharedformalTt;
sharedinterfaceInnerInterface<outU> {
shareddefaultStringinnerInterfaceT => "InnerInterface.T = " + `T`.string;
shareddefaultStringinnerInterfaceU => "InnerInterface.U = " + `U`.string;
shareddefaultTouterT => outer.t;
shareddefaultStringouterInterfaceTFromInnerInterface => outer.outerInterfaceT;
shareddefaultStringouterIdentFromInnerInterface => outer.outerInterfaceIdent;
}
}
classOuterClass() satisfiesOuterInterface<Anything> {
sharedactualAnythingt => null;
sharedactualStringouterInterfaceIdent => "OuterInterface.ident; OuterClass impl";
sharedclassMiddleClass() satisfiesOuterInterface<Object> & OuterInterface<Anything>.InnerInterface<Object> {
sharedactualObjectt => object {};
sharedactualStringouterInterfaceIdent => "OuterInterface.ident; MiddleClass impl";
// `t` should be an Anything from OuterClass's InnerInterface conformanceshareddefaultAnythingsomeT => outerT;
sharedclassInnerClass() extendsMiddleClass() satisfiesOuterInterface<Object>.InnerInterface<String> {
// `t` should be an Object from MiddleClass's InnerInterface conformance,// not Anything from OuterClass's InnerInterface conformancesharedactualObjectsomeT => outerT;
}
}
}
// "Object" (correct), from MiddleClass satisfying OuterInterfaceprint(OuterClass().MiddleClass().InnerClass().outerInterfaceT);
// "Anything" (wrong), this is what we'd expect from MiddleClass's InnerInterface.outer,// but InnerClass's InnerInterface.outer should produce `Object`.print(OuterClass().MiddleClass().InnerClass().outerInterfaceTFromInnerInterface);
// "...MiddleClass impl" (correct), from MiddleClass's overrideprint(OuterClass().MiddleClass().InnerClass().outerInterfaceIdent);
// "...OuterClass impl" (wrong), again what we'd expect from MiddleClass's InnerInterface.outerprint(OuterClass().MiddleClass().InnerClass().outerIdentFromInnerInterface);
// "String" (correct), showing InnerClass actually does acknowledge the// refined satisfaction of InnerInterface, sometimes.print(OuterClass().MiddleClass().InnerClass().innerInterfaceU);
// "Anything" (wrong), T==Anything is never paired with U==Stringprint(OuterClass().MiddleClass().InnerClass().innerInterfaceT);
// "<null>" (wrong, **Objects aren't Null!**)print(OuterClass().MiddleClass().InnerClass().someTofObject);
// These are all normal and correct:print(OuterClass().MiddleClass().outerInterfaceT); // Objectprint(OuterClass().MiddleClass().outerInterfaceTFromInnerInterface); // Anythingprint(OuterClass().MiddleClass().outerInterfaceIdent); // MiddleClass implprint(OuterClass().MiddleClass().outerIdentFromInnerInterface); // OuterClass implprint(OuterClass().MiddleClass().innerInterfaceT); // Anythingprint(OuterClass().MiddleClass().innerInterfaceU); // Objectprint(OuterClass().MiddleClass().someTofAnything); // Null
}
The text was updated successfully, but these errors were encountered:
This one is a definitely a corner case...
In the example below, given multiple candidate instances of
OuterInterface
to use asInnerInterface
'souter
, the wrong one is chosen. The most refined class should be used to as the starting point to determine the outer instance for an interface (working outward), whereas it appears the topmost satisfying class is used as the starting point (also working outward).An instance of
OuterClass
should serve asInnerInterface.outer
for instances ofMiddleClass
. This works.But, an instance of
MiddleClass
should serve asInnerInterface.outer
for instances ofInnerClass
. This does not seem to be working.The text was updated successfully, but these errors were encountered: