private NewInferenceResult FixNondependentParameters()
{
// SPEC: Otherwise, if there exists one or more CType parameters Xi such that
// SPEC: o Xi is unfixed, and
// SPEC: o Xi has a non-empty set of bounds, and
// SPEC: o Xi does not depend on any Xj
// SPEC: then each such Xi is fixed.
// Dependency is only defined for unfixed parameters. Therefore, fixing
// a parameter may cause all of its dependencies to become no longer
// dependent on anything. We need to first determine which parameters need to be
// fixed, and then fix them all at once.
bool[] pNeedsFixing = new bool[_pMethodTypeParameters.size];
int iParam;
NewInferenceResult res = NewInferenceResult.NoProgress;
for (iParam = 0; iParam < _pMethodTypeParameters.size; iParam++)
{
if (IsUnfixed(iParam) && HasBound(iParam) && !DependsOnAny(iParam))
{
pNeedsFixing[iParam] = true;
res = NewInferenceResult.MadeProgress;
}
}
for (iParam = 0; iParam < _pMethodTypeParameters.size; iParam++)
{
// Fix as much as you can, even if there are errors. That will
// help with intellisense.
if (pNeedsFixing[iParam])
{
if (!Fix(iParam))
{
res = NewInferenceResult.InferenceFailed;
}
}
}
return res;
}