Exemple #1
0
 private bool Fix(IGenericParameter genericParameter, InferredType inferredType)
 {
     if (inferredType.Fix())
     {
         Context.TraceVerbose("Generic parameter {0} fixed to {1}.", genericParameter.Name, inferredType.ResultingType);
         return(true);
     }
     return(false);
 }
Exemple #2
0
        private bool FixAll(Predicate <InferredType> predicate)
        {
            bool wasFixed = false;

            foreach (KeyValuePair <IGenericParameter, InferredType> kvp in InferredTypes)
            {
                IGenericParameter gp           = kvp.Key;
                InferredType      inferredType = kvp.Value;

                if (!inferredType.Fixed && predicate(inferredType))
                {
                    wasFixed |= Fix(gp, inferredType);
                }
            }
            return(wasFixed);
        }
Exemple #3
0
        protected virtual bool InferGenericParameter(IGenericParameter formalType, IType actualType, TypeInference inference)
        {
            if (InferredTypes.ContainsKey(formalType))
            {
                InferredType inferredType = InferredTypes[formalType];
                if ((inference & TypeInference.AllowContravariance) != TypeInference.AllowContravariance)
                {
                    inferredType.ApplyLowerBound(actualType);
                }
                if ((inference & TypeInference.AllowCovariance) != TypeInference.AllowCovariance)
                {
                    inferredType.ApplyUpperBound(actualType);
                }
            }

            return(true);
        }
Exemple #4
0
 private bool HasDependantsAndBounds(InferredType inferredType)
 {
     return(inferredType.HasDependants && inferredType.HasBounds);
 }
Exemple #5
0
 private bool HasNoDependencies(InferredType inferredType)
 {
     return(!inferredType.HasDependencies);
 }
 private bool HasDependantsAndBounds(InferredType inferredType)
 {
     return inferredType.HasDependants && inferredType.HasBounds;
 }
 private bool HasNoDependencies(InferredType inferredType)
 {
     return !inferredType.HasDependencies;
 }
 private bool Fix(IGenericParameter genericParameter, InferredType inferredType)
 {
     if (inferredType.Fix())
     {
         Context.TraceVerbose("Generic parameter {0} fixed to {1}.", genericParameter.Name, inferredType.ResultingType);
         return true;
     }
     return false;
 }
Exemple #9
0
		public void RemoveDependencyOn(InferredType dependee)
		{
			_dependencies.Remove(dependee);
			dependee._dependants.Remove(this);
		}
Exemple #10
0
		public void SetDependencyOn(InferredType dependee)
		{
			_dependencies[dependee] = true;
			dependee._dependants[this] = true;
		}
Exemple #11
0
 public void RemoveDependencyOn(InferredType dependee)
 {
     _dependencies.Remove(dependee);
     dependee._dependants.Remove(this);
 }
Exemple #12
0
 public void SetDependencyOn(InferredType dependee)
 {
     _dependencies[dependee]    = true;
     dependee._dependants[this] = true;
 }