public TypeArray typeVars; // All the type variables for a generic method, as declarations.
// If there is a type variable in the method which is used in no parameter,
// then inference must fail. Since this is expensive to check, we cache
// the result of the first call.
public bool InferenceMustFail()
{
if (checkedInfMustFail)
{
return(inferenceMustFail);
}
Debug.Assert(!inferenceMustFail);
checkedInfMustFail = true;
for (int ivar = 0; ivar < typeVars.Size; ivar++)
{
TypeParameterType var = typeVars.ItemAsTypeParameterType(ivar);
// See if type var is used in a parameter.
for (int ipar = 0; ; ipar++)
{
if (ipar >= Params.Size)
{
// This type variable is not in any parameter.
inferenceMustFail = true;
return(true);
}
if (TypeManager.TypeContainsType(Params.Item(ipar), var))
{
break;
}
}
}
// All type variables are used in a parameter.
return(false);
}