/// <summary> /// Returns a constructed type given the type it is constructed from and type arguments for its enclosing types and itself. /// </summary> /// <param name="declaredType">the declared type to construct the result from</param> /// <param name="typeArguments">the type arguments that will replace the type parameters, starting with those for enclosing types</param> /// <returns></returns> internal static NamedTypeSymbol DeepConstruct(this NamedTypeSymbol declaredType, ReadOnlyArray <TypeSymbol> typeArguments) { Debug.Assert(declaredType.OriginalDefinition == declaredType); return(new TypeMap(declaredType.AllTypeParameters().AsReadOnly <TypeSymbol>(), typeArguments).SubstituteNamedType(declaredType)); }