//////////////////////////////////////////////////////////////////////////////// private bool UpperBoundClassInference(AggregateType pSource, CType pDest) { if (!pSource.isClassType() || !pDest.isClassType()) { return false; } // SPEC: Otherwise, if U is a class CType C<U1...Uk> and V is a class CType which // SPEC: inherits directly or indirectly from C<V1...Vk> then an exact // SPEC: inference is made from each Ui to the corresponding Vi. AggregateType pDestBase = pDest.AsAggregateType().GetBaseClass(); while (pDestBase != null) { if (pDestBase.GetOwningAggregate() == pSource.GetOwningAggregate()) { ExactTypeArgumentInference(pSource, pDestBase); return true; } pDestBase = pDestBase.GetBaseClass(); } return false; }
//////////////////////////////////////////////////////////////////////////////// private bool LowerBoundClassInference(CType pSource, AggregateType pDest) { if (!pDest.isClassType()) { return false; } // SPEC: Otherwise, if V is a class CType C<V1...Vk> and U is a class CType which // SPEC: inherits directly or indirectly from C<U1...Uk> // SPEC: then an exact inference is made from each Ui to the corresponding Vi. // SPEC: Otherwise, if V is a class CType C<V1...Vk> and U is a CType parameter // SPEC: with effective base class C<U1...Uk> // SPEC: then an exact inference is made from each Ui to the corresponding Vi. // SPEC: Otherwise, if V is a class CType C<V1...Vk> and U is a CType parameter // SPEC: with an effective base class which inherits directly or indirectly from // SPEC: C<U1...Uk> then an exact inference is made // SPEC: from each Ui to the corresponding Vi. AggregateType pSourceBase = null; if (pSource.isClassType()) { pSourceBase = pSource.AsAggregateType().GetBaseClass(); } else if (pSource.IsTypeParameterType()) { pSourceBase = pSource.AsTypeParameterType().GetEffectiveBaseClass(); } while (pSourceBase != null) { if (pSourceBase.GetOwningAggregate() == pDest.GetOwningAggregate()) { ExactTypeArgumentInference(pSourceBase, pDest); return true; } pSourceBase = pSourceBase.GetBaseClass(); } return false; }