public OverloadResolution(ICompilation compilation, ResolveResult[] arguments, string[] argumentNames = null, IType[] typeArguments = null, CSharpConversions conversions = null) { if (compilation == null) { throw new ArgumentNullException("compilation"); } if (arguments == null) { throw new ArgumentNullException("arguments"); } if (argumentNames == null) { argumentNames = new string[arguments.Length]; } else if (argumentNames.Length != arguments.Length) { throw new ArgumentException("argumentsNames.Length must be equal to arguments.Length"); } this.compilation = compilation; this.arguments = arguments; this.argumentNames = argumentNames; // keep explicitlyGivenTypeArguments==null when no type arguments were specified if (typeArguments != null && typeArguments.Length > 0) { this.explicitlyGivenTypeArguments = typeArguments; } this.conversions = conversions ?? CSharpConversions.Get(compilation); this.AllowExpandingParams = true; }
public TypeInference(ICompilation compilation) { if (compilation == null) { throw new ArgumentNullException("compilation"); } this.compilation = compilation; this.conversions = CSharpConversions.Get(compilation); }
/// <summary> /// Validates whether the given type argument satisfies the constraints for the given type parameter. /// </summary> /// <param name="typeParameter">The type parameter.</param> /// <param name="typeArgument">The type argument.</param> /// <param name="substitution">The substitution that defines how type parameters are replaced with type arguments. /// The substitution is used to check constraints that depend on other type parameters (or recursively on the same type parameter). /// May be null if no substitution should be used.</param> /// <returns>True if the constraints are satisfied; false otherwise.</returns> public static bool ValidateConstraints(ITypeParameter typeParameter, IType typeArgument, TypeVisitor substitution = null) { if (typeParameter == null) { throw new ArgumentNullException("typeParameter"); } if (typeArgument == null) { throw new ArgumentNullException("typeArgument"); } return(ValidateConstraints(typeParameter, typeArgument, substitution, CSharpConversions.Get(typeParameter.Owner.Compilation))); }