diff --git a/src/FSharp.Configuration/AppSettingsProvider.fs b/src/FSharp.Configuration/AppSettingsProvider.fs index c7368c9d..1c870156 100644 --- a/src/FSharp.Configuration/AppSettingsProvider.fs +++ b/src/FSharp.Configuration/AppSettingsProvider.fs @@ -3,7 +3,7 @@ module FSharp.Configuration.AppSettingsTypeProvider #nowarn "57" open FSharp.Configuration.Helper -open Samples.FSharp.ProvidedTypes +open ProviderImplementation.ProvidedTypes open System open System.Configuration open System.Collections.Generic diff --git a/src/FSharp.Configuration/ConfigTypeProvider.fs b/src/FSharp.Configuration/ConfigTypeProvider.fs index 5b36a1fe..ce7cb38f 100644 --- a/src/FSharp.Configuration/ConfigTypeProvider.fs +++ b/src/FSharp.Configuration/ConfigTypeProvider.fs @@ -2,21 +2,21 @@ open FSharp.Configuration.Helper open Microsoft.FSharp.Core.CompilerServices -open Samples.FSharp.ProvidedTypes -open System +open ProviderImplementation.ProvidedTypes [] -type public FSharpConfigurationProvider(cfg: TypeProviderConfig) as this = - inherit TypeProviderForNamespaces() - let context = new Context(this, cfg) - do this.AddNamespace ( - rootNamespace, - [ AppSettingsTypeProvider.typedAppSettings context - ResXProvider.typedResources context - YamlConfigTypeProvider.typedYamlConfig context - IniFileProvider.typedIniFile context ]) - interface IDisposable with - member __.Dispose() = dispose context +type FSharpConfigurationProvider(cfg: TypeProviderConfig) as this = + class + inherit TypeProviderForNamespaces() + let context = new Context(this, cfg) + do this.AddNamespace ( + rootNamespace, + [ AppSettingsTypeProvider.typedAppSettings context + ResXProvider.typedResources context + YamlConfigTypeProvider.typedYamlConfig context + IniFileProvider.typedIniFile context ]) + do this.Disposing.Add (fun _ -> dispose context) + end [] do () \ No newline at end of file diff --git a/src/FSharp.Configuration/IniFileProvider.fs b/src/FSharp.Configuration/IniFileProvider.fs index b8d43a1a..4c9a5fb9 100644 --- a/src/FSharp.Configuration/IniFileProvider.fs +++ b/src/FSharp.Configuration/IniFileProvider.fs @@ -85,7 +85,7 @@ module Parser = // | Setting (setting, s) -> printfn "Success %A, %A" setting s // | x -> printfn "Error: %A" x -open Samples.FSharp.ProvidedTypes +open ProviderImplementation.ProvidedTypes open System.Collections.Generic open System open System.Globalization diff --git a/src/FSharp.Configuration/ProvidedTypes.fs b/src/FSharp.Configuration/ProvidedTypes.fs index a4f30d7c..6c7e7851 100644 --- a/src/FSharp.Configuration/ProvidedTypes.fs +++ b/src/FSharp.Configuration/ProvidedTypes.fs @@ -1,14 +1,17 @@ -// Copyright (c) Microsoft Corporation 2005-2012. +#nowarn "40" +#nowarn "52" +// Based on code for the F# 3.0 Developer Preview release of September 2011, +// Copyright (c) Microsoft Corporation 2005-2012. // This sample code is provided "as is" without warranty of any kind. // We disclaim all warranties, either express or implied, including the // warranties of merchantability and fitness for a particular purpose. // This file contains a set of helper types and methods for providing types in an implementation // of ITypeProvider. -// -// This code is a sample for use in conjunction with the F# 3.0 Beta release of March 2012 -namespace Samples.FSharp.ProvidedTypes +// This code has been modified and is appropriate for use in conjunction with the F# 3.0, F# 3.1, and F# 3.1.1 releases + +namespace ProviderImplementation.ProvidedTypes open System open System.Text @@ -19,6 +22,11 @@ open System.Linq.Expressions open System.Collections.Generic open Microsoft.FSharp.Core.CompilerServices +type E = Quotations.Expr +module P = Quotations.Patterns +module ES = Quotations.ExprShape +module DP = Quotations.DerivedPatterns + type internal ExpectedStackState = | Empty = 1 | Address = 2 @@ -26,14 +34,17 @@ type internal ExpectedStackState = [] module internal Misc = - let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false let TypeBuilderInstantiationType = - if runningOnMono - then typeof.Assembly.GetType("System.Reflection.MonoGenericClass") - else typeof.Assembly.GetType("System.Reflection.Emit.TypeBuilderInstantiation") + let runningOnMono = try System.Type.GetType("Mono.Runtime") <> null with e -> false + let typeName = if runningOnMono then "System.Reflection.MonoGenericClass" else "System.Reflection.Emit.TypeBuilderInstantiation" + typeof.Assembly.GetType(typeName) let GetTypeFromHandleMethod = typeof.GetMethod("GetTypeFromHandle") let LanguagePrimitivesType = typedefof>.Assembly.GetType("Microsoft.FSharp.Core.LanguagePrimitives") let ParseInt32Method = LanguagePrimitivesType.GetMethod "ParseInt32" + let DecimalConstructor = typeof.GetConstructor([| typeof; typeof; typeof; typeof; typeof |]) + let DateTimeConstructor = typeof.GetConstructor([| typeof; typeof |]) + let DateTimeOffsetConstructor = typeof.GetConstructor([| typeof; typeof |]) + let TimeSpanConstructor = typeof.GetConstructor([|typeof|]) let isEmpty s = s = ExpectedStackState.Empty let isAddress s = s = ExpectedStackState.Address @@ -145,6 +156,7 @@ module internal Misc = member __.AddXmlDocDelayed(xmlDoc : unit -> string) = xmlDocDelayed <- Some xmlDoc member this.AddXmlDoc(text:string) = this.AddXmlDocDelayed (fun () -> text) member __.HideObjectMethods with set v = hideObjectMethods <- v + member __.AddCustomAttribute(attribute) = customAttributes.Add(attribute) member __.GetCustomAttributesData() = [| yield! customAttributesOnce.Force() match xmlDocAlwaysRecomputed with None -> () | Some f -> customAttributes.Add(mkXmlDocCustomAttributeData (f())) |] @@ -276,13 +288,155 @@ module internal Misc = else r trans q - let transQuotationToCode isGenerated qexprf (argExprs: Quotations.Expr[]) = + let getFastFuncType (args : list) resultType = + let types = + [| + for arg in args -> arg.Type + yield resultType + |] + let fastFuncTy = + match List.length args with + | 2 -> typedefof>.MakeGenericType(types) + | 3 -> typedefof>.MakeGenericType(types) + | 4 -> typedefof>.MakeGenericType(types) + | 5 -> typedefof>.MakeGenericType(types) + | _ -> invalidArg "args" "incorrect number of arguments" + fastFuncTy.GetMethod("Adapt") + + let inline (===) a b = LanguagePrimitives.PhysicalEquality a b + + let traverse f = + let rec fallback e = + match e with + | P.Let(v, value, body) -> + let fixedValue = f fallback value + let fixedBody = f fallback body + if fixedValue === value && fixedBody === body then + e + else + E.Let(v, fixedValue, fixedBody) + | ES.ShapeVar _ -> e + | ES.ShapeLambda(v, body) -> + let fixedBody = f fallback body + if fixedBody === body then + e + else + E.Lambda(v, fixedBody) + | ES.ShapeCombination(shape, exprs) -> + let exprs1 = List.map (f fallback) exprs + if List.forall2 (===) exprs exprs1 then + e + else + ES.RebuildShapeCombination(shape, exprs1) + fun e -> f fallback e + + let RightPipe = <@@ (|>) @@> + let inlineRightPipe expr = + let rec loop expr = traverse loopCore expr + and loopCore fallback orig = + match orig with + | DP.SpecificCall RightPipe (None, _, [operand; applicable]) -> + let fixedOperand = loop operand + match loop applicable with + | P.Lambda(arg, body) -> + let v = Quotations.Var("__temp", operand.Type) + let ev = E.Var v + + let fixedBody = loop body + E.Let(v, fixedOperand, fixedBody.Substitute(fun v1 -> if v1 = arg then Some ev else None)) + | fixedApplicable -> E.Application(fixedApplicable, fixedOperand) + | x -> fallback x + loop expr + + let inlineValueBindings e = + let map = Dictionary(HashIdentity.Reference) + let rec loop expr = traverse loopCore expr + and loopCore fallback orig = + match orig with + | P.Let(id, (P.Value(_) as v), body) when not id.IsMutable -> + map.[id] <- v + let fixedBody = loop body + map.Remove(id) |> ignore + fixedBody + | ES.ShapeVar v -> + match map.TryGetValue v with + | true, e -> e + | _ -> orig + | x -> fallback x + loop e + + + let optimizeCurriedApplications expr = + let rec loop expr = traverse loopCore expr + and loopCore fallback orig = + match orig with + | P.Application(e, arg) -> + let e1 = tryPeelApplications e [loop arg] + if e1 === e then + orig + else + e1 + | x -> fallback x + and tryPeelApplications orig args = + let n = List.length args + match orig with + | P.Application(e, arg) -> + let e1 = tryPeelApplications e ((loop arg)::args) + if e1 === e then + orig + else + e1 + | P.Let(id, applicable, (P.Lambda(_) as body)) when n > 0 -> + let numberOfApplication = countPeelableApplications body id 0 + if numberOfApplication = 0 then orig + elif n = 1 then E.Application(applicable, List.head args) + elif n <= 5 then + let resultType = + applicable.Type + |> Seq.unfold (fun t -> + if not t.IsGenericType then None + else + let args = t.GetGenericArguments() + if args.Length <> 2 then None + else + Some (args.[1], args.[1]) + ) + |> Seq.nth (n - 1) + + let adaptMethod = getFastFuncType args resultType + let adapted = E.Call(adaptMethod, [loop applicable]) + let invoke = adapted.Type.GetMethod("Invoke", [| for arg in args -> arg.Type |]) + E.Call(adapted, invoke, args) + else + (applicable, args) ||> List.fold (fun e a -> E.Application(e, a)) + | _ -> + orig + and countPeelableApplications expr v n = + match expr with + // v - applicable entity obtained on the prev step + // \arg -> let v1 = (f arg) in rest ==> f + | P.Lambda(arg, P.Let(v1, P.Application(P.Var f, P.Var arg1), rest)) when v = f && arg = arg1 -> countPeelableApplications rest v1 (n + 1) + // \arg -> (f arg) ==> f + | P.Lambda(arg, P.Application(P.Var f, P.Var arg1)) when v = f && arg = arg1 -> n + | _ -> n + loop expr + + // FSharp.Data change: use the real variable names instead of indices, to improve output of Debug.fs + let transQuotationToCode isGenerated qexprf (paramNames: string[]) (argExprs: Quotations.Expr[]) = // add let bindings for arguments to ensure that arguments will be evaluated - let vars = argExprs |> Array.mapi (fun i e -> Quotations.Var(("var" + string i), e.Type)) + let vars = argExprs |> Array.mapi (fun i e -> Quotations.Var(paramNames.[i], e.Type)) let expr = qexprf ([for v in vars -> Quotations.Expr.Var v]) let pairs = Array.zip argExprs vars let expr = Array.foldBack (fun (arg, var) e -> Quotations.Expr.Let(var, arg, e)) pairs expr + let expr = + if isGenerated then + let e1 = inlineRightPipe expr + let e2 = optimizeCurriedApplications e1 + let e3 = inlineValueBindings e2 + e3 + else + expr transExpr isGenerated expr @@ -327,6 +481,7 @@ type ProvidedParameter(name:string,parameterType:Type,?isOut:bool,?optionalValue override this.Attributes = (base.Attributes ||| (if isOut then ParameterAttributes.Out else enum 0) ||| (match optionalValue with None -> enum 0 | Some _ -> ParameterAttributes.Optional ||| ParameterAttributes.HasDefault)) override this.RawDefaultValue = defaultArg optionalValue null + member this.HasDefaultParameterValue = Option.isSome optionalValue member __.GetCustomAttributesDataImpl() = customAttributesImpl.GetCustomAttributesData() #if FX_NO_CUSTOMATTRIBUTEDATA #else @@ -382,7 +537,14 @@ type ProvidedConstructor(parameters : ProvidedParameter list) = member this.GetInvokeCodeInternal isGenerated = match invokeCode with - | Some f -> transQuotationToCode isGenerated f + | Some f -> + // FSharp.Data change: use the real variable names instead of indices, to improve output of Debug.fs + let paramNames = + parameters + |> List.map (fun p -> p.Name) + |> List.append (if not isGenerated || this.IsStatic then [] else ["this"]) + |> Array.ofList + transQuotationToCode isGenerated f paramNames | None -> failwith (sprintf "ProvidedConstructor: no invoker for '%s'" (nameText())) member this.GetBaseConstructorCallInternal isGenerated = @@ -421,6 +583,7 @@ type ProvidedMethod(methodName: string, parameters: ProvidedParameter list, retu member this.AddXmlDoc xmlDoc = customAttributesImpl.AddXmlDoc xmlDoc member this.AddObsoleteAttribute (msg,?isError) = customAttributesImpl.AddObsolete (msg,defaultArg isError false) member this.AddDefinitionLocation(line,column,filePath) = customAttributesImpl.AddDefinitionLocation(line, column, filePath) + member __.AddCustomAttribute(attribute) = customAttributesImpl.AddCustomAttribute(attribute) member __.GetCustomAttributesDataImpl() = customAttributesImpl.GetCustomAttributesData() #if FX_NO_CUSTOMATTRIBUTEDATA #else @@ -443,7 +606,14 @@ type ProvidedMethod(methodName: string, parameters: ProvidedParameter list, retu member this.GetInvokeCodeInternal isGenerated = match invokeCode with - | Some f -> transQuotationToCode isGenerated f + | Some f -> + // FSharp.Data change: use the real variable names instead of indices, to improve output of Debug.fs + let paramNames = + parameters + |> List.map (fun p -> p.Name) + |> List.append (if this.IsStatic then [] else ["this"]) + |> Array.ofList + transQuotationToCode isGenerated f paramNames | None -> failwith (sprintf "ProvidedMethod: no invoker for %s on type %s" this.Name (if declaringType=null then "" else declaringType.FullName)) // Implement overloads override this.GetParameters() = argParams |> Array.ofList @@ -500,6 +670,7 @@ type ProvidedProperty(propertyName:string,propertyType:Type, ?parameters:Provide member this.AddObsoleteAttribute (msg,?isError) = customAttributesImpl.AddObsolete (msg,defaultArg isError false) member this.AddDefinitionLocation(line,column,filePath) = customAttributesImpl.AddDefinitionLocation(line, column, filePath) member __.GetCustomAttributesDataImpl() = customAttributesImpl.GetCustomAttributesData() + member this.AddCustomAttribute attribute = customAttributesImpl.AddCustomAttribute attribute #if FX_NO_CUSTOMATTRIBUTEDATA #else override this.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() @@ -671,6 +842,7 @@ type ProvidedField(fieldName:string,fieldType:Type) = override this.FieldHandle = notRequired "FieldHandle" this.Name /// Represents the type constructor in a provided symbol type. +[] type SymbolKind = | SDArray | Array of int @@ -686,6 +858,19 @@ type SymbolKind = type ProvidedSymbolType(kind: SymbolKind, args: Type list) = inherit Type() + let rec isEquivalentTo (thisTy: Type) (otherTy: Type) = + match thisTy, otherTy with + | (:? ProvidedSymbolType as thisTy), (:? ProvidedSymbolType as thatTy) -> (thisTy.Kind,thisTy.Args) = (thatTy.Kind, thatTy.Args) + | (:? ProvidedSymbolType as thisTy), otherTy | otherTy, (:? ProvidedSymbolType as thisTy) -> + match thisTy.Kind, thisTy.Args with + | SymbolKind.SDArray, [ty] | SymbolKind.Array _, [ty] when otherTy.IsArray-> ty.Equals(otherTy.GetElementType()) + | SymbolKind.ByRef, [ty] when otherTy.IsByRef -> ty.Equals(otherTy.GetElementType()) + | SymbolKind.Pointer, [ty] when otherTy.IsPointer -> ty.Equals(otherTy.GetElementType()) + | SymbolKind.Generic baseTy, args -> otherTy.IsGenericType && isEquivalentTo baseTy (otherTy.GetGenericTypeDefinition()) && Seq.forall2 isEquivalentTo args (otherTy.GetGenericArguments()) + | _ -> false + | a, b -> a.Equals b + + static member convType (parameters: Type list) (ty:Type) = if ty.IsGenericType then let args = Array.map (ProvidedSymbolType.convType parameters) (ty.GetGenericArguments()) @@ -734,7 +919,7 @@ type ProvidedSymbolType(kind: SymbolKind, args: Type list) = if otherTy.IsGenericType then let otherGtd = otherTy.GetGenericTypeDefinition() let otherArgs = otherTy.GetGenericArguments() - let yes = gtd.Equals(otherGtd) && Seq.forall2 (=) args otherArgs + let yes = gtd.Equals(otherGtd) && Seq.forall2 isEquivalentTo args otherArgs yes else base.IsAssignableFrom(otherTy) @@ -792,14 +977,15 @@ type ProvidedSymbolType(kind: SymbolKind, args: Type list) = | SymbolKind.Generic gty,_ -> 9797 + hash gty + List.sumBy hash args | SymbolKind.FSharpTypeAbbreviation _,_ -> 3092 | _ -> failwith "unreachable" - member this.Kind = kind - member this.Args = args - override this.Equals(that:obj) = - match that with - | :? ProvidedSymbolType as that -> (kind,args) = (that.Kind, that.Args) + override this.Equals(other: obj) = + match other with + | :? ProvidedSymbolType as otherTy -> (kind, args) = (otherTy.Kind, otherTy.Args) | _ -> false + member this.Kind = kind + member this.Args = args + override this.GetConstructors _bindingAttr = notRequired "GetConstructors" this.Name override this.GetMethodImpl(_name, _bindingAttr, _binderBinder, _callConvention, _types, _modifiers) = match kind with @@ -841,6 +1027,9 @@ type ProvidedSymbolType(kind: SymbolKind, args: Type list) = override this.GetCustomAttributes(_inherit) = [| |] override this.GetCustomAttributes(_attributeType, _inherit) = [| |] override this.IsDefined(_attributeType, _inherit) = false + // FSharp.Data addition: this was added to support arrays of arrays + override this.MakeArrayType() = ProvidedSymbolType(SymbolKind.SDArray, [this]) :> Type + override this.MakeArrayType arg = ProvidedSymbolType(SymbolKind.Array arg, [this]) :> Type type ProvidedSymbolMethod(genericMethodDefinition: MethodInfo, parameters: Type list) = inherit System.Reflection.MethodInfo() @@ -891,6 +1080,19 @@ type ProvidedTypeBuilder() = [] type ProvidedMeasureBuilder() = + // TODO: this shouldn't be hardcoded, but without creating a dependency on Microsoft.FSharp.Metadata in F# PowerPack + // there seems to be no way to check if a type abbreviation exists + let unitNamesTypeAbbreviations = + [ "meter"; "hertz"; "newton"; "pascal"; "joule"; "watt"; "coulomb"; + "volt"; "farad"; "ohm"; "siemens"; "weber"; "tesla"; "henry" + "lumen"; "lux"; "becquerel"; "gray"; "sievert"; "katal" ] + |> Set.ofList + + let unitSymbolsTypeAbbreviations = + [ "m"; "kg"; "s"; "A"; "K"; "mol"; "cd"; "Hz"; "N"; "Pa"; "J"; "W"; "C" + "V"; "F"; "S"; "Wb"; "T"; "lm"; "lx"; "Bq"; "Gy"; "Sv"; "kat"; "H" ] + |> Set.ofList + static let theBuilder = ProvidedMeasureBuilder() static member Default = theBuilder member b.One = typeof @@ -898,21 +1100,35 @@ type ProvidedMeasureBuilder() = member b.Inverse m = typedefof>.MakeGenericType [| m |] member b.Ratio (m1, m2) = b.Product(m1, b.Inverse m2) member b.Square m = b.Product(m, m) - member b.SI m = - match typedefof>.Assembly.GetType("Microsoft.FSharp.Data.UnitSystems.SI.UnitNames."+m) with - | null -> + + // FSharp.Data change: if the unit is not a valid type, instead + // of assuming it's a type abbreviation, which may not be the case and cause a + // problem later on, check the list of valid abbreviations + member b.SI (m:string) = + let mLowerCase = m.ToLowerInvariant() + let abbreviation = + if unitNamesTypeAbbreviations.Contains mLowerCase then + Some ("Microsoft.FSharp.Data.UnitSystems.SI.UnitNames", mLowerCase) + elif unitSymbolsTypeAbbreviations.Contains m then + Some ("Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols", m) + else + None + match abbreviation with + | Some (ns, unitName) -> ProvidedSymbolType (SymbolKind.FSharpTypeAbbreviation (typeof.Assembly, - "Microsoft.FSharp.Data.UnitSystems.SI.UnitNames", - [| m |]), + ns, + [| unitName |]), []) :> Type - | v -> v + | None -> + typedefof>.Assembly.GetType("Microsoft.FSharp.Data.UnitSystems.SI.UnitNames." + mLowerCase) + member b.AnnotateType (basicType, annotation) = ProvidedSymbolType(Generic basicType, annotation) :> Type -[] +[] type TypeContainer = | Namespace of Assembly * string // namespace | Type of System.Type @@ -931,6 +1147,7 @@ type ProvidedTypeDefinition(container:TypeContainer,className : string, baseType enum (int32 TypeProviderTypeAttributes.IsErased) + let mutable enumUnderlyingType = typeof let mutable baseType = lazy baseType let mutable membersKnown = ResizeArray() let mutable membersQueue = ResizeArray<(unit -> list)>() @@ -1025,6 +1242,7 @@ type ProvidedTypeDefinition(container:TypeContainer,className : string, baseType member this.AddDefinitionLocation(line,column,filePath) = customAttributesImpl.AddDefinitionLocation(line, column, filePath) member this.HideObjectMethods with set v = customAttributesImpl.HideObjectMethods <- v member __.GetCustomAttributesDataImpl() = customAttributesImpl.GetCustomAttributesData() + member this.AddCustomAttribute attribute = customAttributesImpl.AddCustomAttribute attribute #if FX_NO_CUSTOMATTRIBUTEDATA #else override this.GetCustomAttributesData() = customAttributesImpl.GetCustomAttributesData() @@ -1036,6 +1254,9 @@ type ProvidedTypeDefinition(container:TypeContainer,className : string, baseType new (className,baseType) = new ProvidedTypeDefinition(TypeContainer.TypeToBeDecided, className, baseType) // state ops + override this.UnderlyingSystemType = typeof + member this.SetEnumUnderlyingType(ty) = enumUnderlyingType <- ty + override this.GetEnumUnderlyingType() = if this.IsEnum then enumUnderlyingType else invalidOp "not enum type" member this.SetBaseType t = baseType <- lazy Some t member this.SetBaseTypeDelayed t = baseType <- t member this.SetAttributes x = attributes <- x @@ -1192,6 +1413,35 @@ type ProvidedTypeDefinition(container:TypeContainer,className : string, baseType override this.MakePointerType() = ProvidedSymbolType(SymbolKind.Pointer, [this]) :> Type override this.MakeByRefType() = ProvidedSymbolType(SymbolKind.ByRef, [this]) :> Type + // FSharp.Data addition: this method is used by Debug.fs and QuotationBuilder.fs + // Emulate the F# type provider type erasure mechanism to get the + // actual (erased) type. We erase ProvidedTypes to their base type + // and we erase array of provided type to array of base type. In the + // case of generics all the generic type arguments are also recursively + // replaced with the erased-to types + static member EraseType(t:Type) = + match t with + | :? ProvidedTypeDefinition -> ProvidedTypeDefinition.EraseType t.BaseType + | :? ProvidedSymbolType as sym -> + match sym.Kind, sym.Args with + | SymbolKind.SDArray, [typ] -> + let (t:Type) = ProvidedTypeDefinition.EraseType typ + t.MakeArrayType() + | SymbolKind.Generic genericTypeDefinition, typeArgs -> + let genericArguments = + typeArgs + |> List.toArray + |> Array.map ProvidedTypeDefinition.EraseType + genericTypeDefinition.MakeGenericType(genericArguments) + | _ -> failwith "getTypeErasedTo: Unsupported ProvidedSymbolType" + | t when t.IsGenericType && not t.IsGenericTypeDefinition -> + let genericTypeDefinition = t.GetGenericTypeDefinition() + let genericArguments = + t.GetGenericArguments() + |> Array.map ProvidedTypeDefinition.EraseType + genericTypeDefinition.MakeGenericType(genericArguments) + | t -> t + // The binding attributes are always set to DeclaredOnly ||| Static ||| Instance ||| Public when GetMembers is called directly by the F# compiler // However, it's possible for the framework to generate other sets of flags in some corner cases (e.g. via use of `enum` with a provided type as the target) override this.GetMembers bindingAttr = @@ -1219,7 +1469,9 @@ type ProvidedTypeDefinition(container:TypeContainer,className : string, baseType if bindingAttr.HasFlag(BindingFlags.DeclaredOnly) || this.BaseType = null then mems else - let baseMems = this.BaseType.GetMembers bindingAttr + // FSharp.Data change: just using this.BaseType is not enough in the case of CsvProvider, + // because the base type is CsvRow, so we have to erase recursively to CsvRow + let baseMems = (ProvidedTypeDefinition.EraseType this.BaseType).GetMembers bindingAttr Array.append mems baseMems override this.GetNestedTypes bindingAttr = @@ -1252,7 +1504,6 @@ type ProvidedTypeDefinition(container:TypeContainer,className : string, baseType override this.IsPrimitiveImpl() = false override this.IsCOMObjectImpl() = false override this.HasElementTypeImpl() = false - override this.UnderlyingSystemType = typeof override this.Name = className override this.DeclaringType = declaringType.Force() override this.MemberType = if this.IsNested then MemberTypes.NestedType else MemberTypes.TypeInfo @@ -1308,6 +1559,7 @@ type AssemblyGenerator(assemblyFileName) = let uniqueLambdaTypeName() = // lambda name should be unique across all types that all type provider might contribute in result assembly sprintf "Lambda%O" (Guid.NewGuid()) + member __.Assembly = assembly :> Assembly /// Emit the given provided type definitions into an assembly and adjust 'Assembly' property of all type definitions to return that /// assembly. @@ -1387,7 +1639,7 @@ type AssemblyGenerator(assemblyFileName) = let ctorMap = Dictionary(HashIdentity.Reference) let methMap = Dictionary(HashIdentity.Reference) - let fieldMap = Dictionary(HashIdentity.Reference) + let fieldMap = Dictionary(HashIdentity.Reference) let iterateTypes f = let rec typeMembers (ptd : ProvidedTypeDefinition) = @@ -1449,20 +1701,48 @@ type AssemblyGenerator(assemblyFileName) = ctorMap.[pcinfo] <- cb | _ -> () + if ptd.IsEnum then + tb.DefineField("value__", ptd.GetEnumUnderlyingType(), FieldAttributes.Public ||| FieldAttributes.SpecialName ||| FieldAttributes.RTSpecialName) + |> ignore + for finfo in ptd.GetFields(ALL) do - match finfo with - | :? ProvidedField as pfinfo when not (fieldMap.ContainsKey pfinfo) -> - let fb = tb.DefineField(finfo.Name, convType finfo.FieldType, finfo.Attributes) - let cattr = pfinfo.GetCustomAttributesDataImpl() + let fieldInfo = + match finfo with + | :? ProvidedField as pinfo -> + Some (pinfo.Name, convType finfo.FieldType, finfo.Attributes, pinfo.GetCustomAttributesDataImpl(), None) + | :? ProvidedLiteralField as pinfo -> + Some (pinfo.Name, convType finfo.FieldType, finfo.Attributes, pinfo.GetCustomAttributesDataImpl(), Some (pinfo.GetRawConstantValue())) + | _ -> None + match fieldInfo with + | Some (name, ty, attr, cattr, constantVal) when not (fieldMap.ContainsKey finfo) -> + let fb = tb.DefineField(name, ty, attr) + if constantVal.IsSome then + fb.SetConstant constantVal.Value defineCustomAttrs fb.SetCustomAttribute cattr - fieldMap.[pfinfo] <- fb + fieldMap.[finfo] <- fb | _ -> () for minfo in ptd.GetMethods(ALL) do match minfo with | :? ProvidedMethod as pminfo when not (methMap.ContainsKey pminfo) -> let mb = tb.DefineMethod(minfo.Name, minfo.Attributes, convType minfo.ReturnType, [| for p in minfo.GetParameters() -> convType p.ParameterType |]) - for (i,p) in minfo.GetParameters() |> Seq.mapi (fun i x -> (i,x)) do - mb.DefineParameter(i+1, ParameterAttributes.None, p.Name) |> ignore + for (i, p) in minfo.GetParameters() |> Seq.mapi (fun i x -> (i,x :?> ProvidedParameter)) do + // TODO: check why F# compiler doesn't emit default value when just p.Attributes is used (thus bad metadata is emitted) +// let mutable attrs = ParameterAttributes.None +// +// if p.IsOut then attrs <- attrs ||| ParameterAttributes.Out +// if p.HasDefaultParameterValue then attrs <- attrs ||| ParameterAttributes.Optional + + let pb = mb.DefineParameter(i+1, p.Attributes, p.Name) + if p.HasDefaultParameterValue then + do + let ctor = typeof.GetConstructor([|typeof|]) + let builder = new CustomAttributeBuilder(ctor, [|p.RawDefaultValue|]) + pb.SetCustomAttribute builder + do + let ctor = typeof.GetConstructor([||]) + let builder = new CustomAttributeBuilder(ctor, [||]) + pb.SetCustomAttribute builder + pb.SetConstant p.RawDefaultValue methMap.[pminfo] <- mb | _ -> () @@ -1521,7 +1801,7 @@ type AssemblyGenerator(assemblyFileName) = emitExpr (ilg, copyOfLocals, [| Quotations.Var("this", lambda); v|]) expectedState body ilg.Emit(OpCodes.Ret) - let ty = lambda.CreateType() + lambda.CreateType() |> ignore callSiteIlg.Emit(OpCodes.Newobj, ctor) for (v, f) in fields do @@ -1648,7 +1928,7 @@ type AssemblyGenerator(assemblyFileName) = ilg.Emit(OpCodes.Castclass, targetTy) popIfEmptyExpected expectedState - | Quotations.DerivedPatterns.SpecificCall <@ (-) @>(None, [t1; t2; t3], [a1; a2]) -> + | Quotations.DerivedPatterns.SpecificCall <@ (-) @>(None, [t1; t2; _], [a1; a2]) -> assert(t1 = t2) emit ExpectedStackState.Value a1 emit ExpectedStackState.Value a2 @@ -1660,7 +1940,7 @@ type AssemblyGenerator(assemblyFileName) = popIfEmptyExpected expectedState - | Quotations.DerivedPatterns.SpecificCall <@ (/) @> (None, [t1; t2; t3], [a1; a2]) -> + | Quotations.DerivedPatterns.SpecificCall <@ (/) @> (None, [t1; t2; _], [a1; a2]) -> assert (t1 = t2) emit ExpectedStackState.Value a1 emit ExpectedStackState.Value a2 @@ -1732,12 +2012,20 @@ type AssemblyGenerator(assemblyFileName) = popIfEmptyExpected expectedState | Quotations.Patterns.FieldGet (objOpt,field) -> + match field with + | :? ProvidedLiteralField as plf when plf.DeclaringType.IsEnum -> + if expectedState <> ExpectedStackState.Empty then + emit expectedState (Quotations.Expr.Value(field.GetRawConstantValue(), field.FieldType.GetEnumUnderlyingType())) + | _ -> match objOpt with | None -> () | Some e -> let s = if e.Type.IsValueType then ExpectedStackState.Address else ExpectedStackState.Value emit s e - let field = match field with :? ProvidedField as pf when fieldMap.ContainsKey pf -> fieldMap.[pf] :> FieldInfo | m -> m + let field = + match field with + | :? ProvidedField as pf when fieldMap.ContainsKey pf -> fieldMap.[pf] :> FieldInfo + | m -> m if field.IsStatic then ilg.Emit(OpCodes.Ldsfld, field) else @@ -1824,13 +2112,34 @@ type AssemblyGenerator(assemblyFileName) = | :? bool as x -> ilg.Emit(OpCodes.Ldc_I4, if x then 1 else 0) | :? float32 as x -> ilg.Emit(OpCodes.Ldc_R4, x) | :? float as x -> ilg.Emit(OpCodes.Ldc_R8, x) -#if BROWSER +#if FX_NO_GET_ENUM_UNDERLYING_TYPE #else | :? System.Enum as x when x.GetType().GetEnumUnderlyingType() = typeof -> ilg.Emit(OpCodes.Ldc_I4, unbox v) #endif | :? Type as ty -> ilg.Emit(OpCodes.Ldtoken, convType ty) ilg.Emit(OpCodes.Call, Misc.GetTypeFromHandleMethod) + | :? decimal as x -> + let bits = System.Decimal.GetBits x + ilg.Emit(OpCodes.Ldc_I4, bits.[0]) + ilg.Emit(OpCodes.Ldc_I4, bits.[1]) + ilg.Emit(OpCodes.Ldc_I4, bits.[2]) + do + let sign = (bits.[3] &&& 0x80000000) <> 0 + ilg.Emit(if sign then OpCodes.Ldc_I4_1 else OpCodes.Ldc_I4_0) + do + let scale = byte ((bits.[3] >>> 16) &&& 0x7F) + ilg.Emit(OpCodes.Ldc_I4_S, scale) + ilg.Emit(OpCodes.Newobj, Misc.DecimalConstructor) + | :? DateTime as x -> + ilg.Emit(OpCodes.Ldc_I8, x.Ticks) + ilg.Emit(OpCodes.Ldc_I4, int x.Kind) + ilg.Emit(OpCodes.Newobj, Misc.DateTimeConstructor) + | :? DateTimeOffset as x -> + ilg.Emit(OpCodes.Ldc_I8, x.Ticks) + ilg.Emit(OpCodes.Ldc_I8, x.Offset.Ticks) + ilg.Emit(OpCodes.Newobj, Misc.TimeSpanConstructor) + ilg.Emit(OpCodes.Newobj, Misc.DateTimeOffsetConstructor) | null -> ilg.Emit(OpCodes.Ldnull) | _ -> failwithf "unknown constant '%A' in generated method" v if isEmpty expectedState then () @@ -1912,7 +2221,6 @@ type AssemblyGenerator(assemblyFileName) = let cattr = pcinfo.GetCustomAttributesDataImpl() defineCustomAttrs cb.SetCustomAttribute cattr let ilg = cb.GetILGenerator() - ilg.Emit(OpCodes.Ldarg_0) let locals = Dictionary() let parameterVars = [| yield Quotations.Var("this", pcinfo.DeclaringType) @@ -1922,9 +2230,11 @@ type AssemblyGenerator(assemblyFileName) = [| for v in parameterVars -> Quotations.Expr.Var v |] match pcinfo.GetBaseConstructorCallInternal true with | None -> + ilg.Emit(OpCodes.Ldarg_0) let cinfo = ptd.BaseType.GetConstructor(BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance, null, [| |], null) ilg.Emit(OpCodes.Call,cinfo) | Some f -> + // argExprs should always include 'this' let (cinfo,argExprs) = f (Array.toList parameters) for argExpr in argExprs do emitExpr (ilg, locals, parameterVars) ExpectedStackState.Value argExpr @@ -2060,7 +2370,7 @@ type ProvidedAssembly(assemblyFileName: string) = //printfn "registered assembly in '%s'" fileName let assemblyBytes = System.IO.File.ReadAllBytes fileName let assembly = Assembly.Load(assemblyBytes,null,System.Security.SecurityContextSource.CurrentAppDomain) - GlobalProvidedAssemblyElementsTable.theTable.Add(assembly, Lazy.CreateFromValue assemblyBytes) + GlobalProvidedAssemblyElementsTable.theTable.Add(assembly, Lazy<_>.CreateFromValue assemblyBytes) assembly #endif @@ -2082,7 +2392,11 @@ module Local = } +#if FX_NO_LOCAL_FILESYSTEM +type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list)>) = +#else type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list)>) as this = +#endif let otherNamespaces = ResizeArray>() let providedNamespaces = @@ -2093,6 +2407,8 @@ type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list() + let disposing = Event() + #if FX_NO_LOCAL_FILESYSTEM #else let probingFolders = ResizeArray() @@ -2103,9 +2419,13 @@ type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list) = new TypeProviderForNamespaces([(namespaceName,types)]) new () = new TypeProviderForNamespaces([]) + [] + member this.Disposing = disposing.Publish + #if FX_NO_LOCAL_FILESYSTEM interface System.IDisposable with - member x.Dispose() = () + member x.Dispose() = + disposing.Trigger(x, EventArgs.Empty) #else abstract member ResolveAssembly : args : System.ResolveEventArgs -> Assembly default this.ResolveAssembly(args) = @@ -2126,11 +2446,16 @@ type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list IO.Path.GetDirectoryName |> this.RegisterProbingFolder + interface System.IDisposable with - member x.Dispose() = AppDomain.CurrentDomain.remove_AssemblyResolve handler + member x.Dispose() = + disposing.Trigger(x, EventArgs.Empty) + AppDomain.CurrentDomain.remove_AssemblyResolve handler #endif member __.AddNamespace (namespaceName,types:list<_>) = otherNamespaces.Add (namespaceName,types) + // FSharp.Data addition: this method is used by Debug.fs + member __.Namespaces = Seq.readonly otherNamespaces member self.Invalidate() = invalidateE.Trigger(self,EventArgs()) interface ITypeProvider with [] @@ -2228,6 +2553,6 @@ type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list bytes.Force() | _ -> let bytes = System.IO.File.ReadAllBytes assembly.ManifestModule.FullyQualifiedName - GlobalProvidedAssemblyElementsTable.theTable.[assembly] <- Lazy.CreateFromValue bytes + GlobalProvidedAssemblyElementsTable.theTable.[assembly] <- Lazy<_>.CreateFromValue bytes bytes -#endif \ No newline at end of file +#endif diff --git a/src/FSharp.Configuration/ProvidedTypes.fsi b/src/FSharp.Configuration/ProvidedTypes.fsi index 27ab3d4d..ceee8ed0 100644 --- a/src/FSharp.Configuration/ProvidedTypes.fsi +++ b/src/FSharp.Configuration/ProvidedTypes.fsi @@ -1,14 +1,16 @@ -// Copyright (c) Microsoft Corporation 2005-2012. +// Based on code developed for the F# 3.0 Beta release of March 2012, +// Copyright (c) Microsoft Corporation 2005-2012. // This sample code is provided "as is" without warranty of any kind. // We disclaim all warranties, either express or implied, including the // warranties of merchantability and fitness for a particular purpose. // This file contains a set of helper types and methods for providing types in an implementation // of ITypeProvider. -// -// This code is a sample for use in conjunction with the F# 3.0 Developer Preview release of September 2011. -namespace Samples.FSharp.ProvidedTypes +// This code has been modified and is appropriate for use in conjunction with the F# 3.0, F# 3.1, and F# 3.1.1 releases + + +namespace ProviderImplementation.ProvidedTypes open System open System.Reflection @@ -16,13 +18,13 @@ open System.Linq.Expressions open Microsoft.FSharp.Core.CompilerServices /// Represents an erased provided parameter -type internal ProvidedParameter = +type ProvidedParameter = inherit System.Reflection.ParameterInfo new : parameterName: string * parameterType: Type * ?isOut:bool * ?optionalValue:obj -> ProvidedParameter member IsParamArray : bool with get,set /// Represents an erased provided constructor. -type internal ProvidedConstructor = +type ProvidedConstructor = inherit System.Reflection.ConstructorInfo /// Create a new provided constructor. It is not initially associated with any specific provided type definition. @@ -43,20 +45,23 @@ type internal ProvidedConstructor = /// Set the quotation used to compute the implementation of invocations of this constructor. member InvokeCode : (Quotations.Expr list -> Quotations.Expr) with set + /// FSharp.Data addition: this method is used by Debug.fs + member internal GetInvokeCodeInternal : bool -> (Quotations.Expr [] -> Quotations.Expr) + /// Set the target and arguments of the base constructor call. Only used for generated types. member BaseConstructorCall : (Quotations.Expr list -> ConstructorInfo * Quotations.Expr list) with set /// Set a flag indicating that the constructor acts like an F# implicit constructor, so the /// parameters of the constructor become fields and can be accessed using Expr.GlobalVar with the /// same name. - member IsImplicitCtor : bool with set + member IsImplicitCtor : bool with get,set /// Add definition location information to the provided constructor. member AddDefinitionLocation : line:int * column:int * filePath:string -> unit member IsTypeInitializer : bool with get,set -type internal ProvidedMethod = +type ProvidedMethod = inherit System.Reflection.MethodInfo /// Create a new provided method. It is not initially associated with any specific provided type definition. @@ -86,14 +91,19 @@ type internal ProvidedMethod = /// Set the quotation used to compute the implementation of invocations of this method. member InvokeCode : (Quotations.Expr list -> Quotations.Expr) with set + /// FSharp.Data addition: this method is used by Debug.fs + member internal GetInvokeCodeInternal : bool -> (Quotations.Expr [] -> Quotations.Expr) /// Add definition location information to the provided type definition. member AddDefinitionLocation : line:int * column:int * filePath:string -> unit + /// Add a custom attribute to the provided method definition. + member AddCustomAttribute : CustomAttributeData -> unit + /// Represents an erased provided property. -type internal ProvidedProperty = +type ProvidedProperty = inherit System.Reflection.PropertyInfo /// Create a new provided type. It is not initially associated with any specific provided type definition. @@ -113,6 +123,7 @@ type internal ProvidedProperty = member AddXmlDocComputed : xmlDocFunction: (unit -> string) -> unit /// Get or set a flag indicating if the property is static. + /// FSharp.Data addition: the getter is used by Debug.fs member IsStatic : bool with get,set /// Set the quotation used to compute the implementation of gets of this property. @@ -124,8 +135,11 @@ type internal ProvidedProperty = /// Add definition location information to the provided type definition. member AddDefinitionLocation : line:int * column:int * filePath:string -> unit + /// Add a custom attribute to the provided property definition. + member AddCustomAttribute : CustomAttributeData -> unit + /// Represents an erased provided property. -type internal ProvidedEvent = +type ProvidedEvent = inherit System.Reflection.EventInfo /// Create a new provided type. It is not initially associated with any specific provided type definition. @@ -154,7 +168,7 @@ type internal ProvidedEvent = member AddDefinitionLocation : line:int * column:int * filePath:string -> unit /// Represents an erased provided field. -type internal ProvidedLiteralField = +type ProvidedLiteralField = inherit System.Reflection.FieldInfo /// Create a new provided field. It is not initially associated with any specific provided type definition. @@ -177,7 +191,7 @@ type internal ProvidedLiteralField = member AddDefinitionLocation : line:int * column:int * filePath:string -> unit /// Represents an erased provided field. -type internal ProvidedField = +type ProvidedField = inherit System.Reflection.FieldInfo /// Create a new provided field. It is not initially associated with any specific provided type definition. @@ -201,9 +215,34 @@ type internal ProvidedField = member SetFieldAttributes : attributes : FieldAttributes -> unit +/// FSharp.Data addition: SymbolKind is used by AssemblyReplacer.fs +/// Represents the type constructor in a provided symbol type. +[] +type SymbolKind = + | SDArray + | Array of int + | Pointer + | ByRef + | Generic of System.Type + | FSharpTypeAbbreviation of (System.Reflection.Assembly * string * string[]) + +/// FSharp.Data addition: ProvidedSymbolType is used by AssemblyReplacer.fs +/// Represents an array or other symbolic type involving a provided type as the argument. +/// See the type provider spec for the methods that must be implemented. +/// Note that the type provider specification does not require us to implement pointer-equality for provided types. +[] +type ProvidedSymbolType = + inherit System.Type + + /// Returns the kind of this symbolic type + member Kind : SymbolKind + /// Return the provided types used as arguments of this symbolic type + member Args : list + + /// Provides symbolic provided types [] -type internal ProvidedTypeBuilder = +type ProvidedTypeBuilder = /// Like typ.MakeGenericType, but will also work with unit-annotated types static member MakeGenericType: genericTypeDefinition: System.Type * genericArguments: System.Type list -> System.Type /// Like methodInfo.MakeGenericMethod, but will also work with unit-annotated types and provided types @@ -211,7 +250,7 @@ type internal ProvidedTypeBuilder = /// Helps create erased provided unit-of-measure annotations. [] -type internal ProvidedMeasureBuilder = +type ProvidedMeasureBuilder = /// The ProvidedMeasureBuilder for building measures. static member Default : ProvidedMeasureBuilder @@ -237,7 +276,7 @@ type internal ProvidedMeasureBuilder = /// Represents a provided static parameter. -type internal ProvidedStaticParameter = +type ProvidedStaticParameter = inherit System.Reflection.ParameterInfo new : parameterName: string * parameterType:Type * ?parameterDefaultValue:obj -> ProvidedStaticParameter @@ -248,7 +287,7 @@ type internal ProvidedStaticParameter = member AddXmlDocDelayed : xmlDocFunction: (unit -> string) -> unit /// Represents a provided type definition. -type internal ProvidedTypeDefinition = +type ProvidedTypeDefinition = inherit System.Type /// Create a new provided type definition in a namespace. @@ -278,6 +317,9 @@ type internal ProvidedTypeDefinition = /// Set the base type to a lazily evaluated value member SetBaseTypeDelayed : Lazy -> unit + /// Set underlying type for generated enums + member SetEnumUnderlyingType : Type -> unit + /// Add XML documentation information to this provided constructor, where the computation of the documentation is delayed until necessary. /// The documentation is only computed once. member AddXmlDocDelayed : xmlDocFunction: (unit -> string) -> unit @@ -322,8 +364,20 @@ type internal ProvidedTypeDefinition = [] member SuppressRelocation : bool with get,set + /// FSharp.Data addition: this method is used by Debug.fs member MakeParametricType : name:string * args:obj[] -> ProvidedTypeDefinition + /// Add a custom attribute to the provided type definition. + member AddCustomAttribute : CustomAttributeData -> unit + + /// FSharp.Data addition: this method is used by Debug.fs and QuotationBuilder.fs + /// Emulate the F# type provider type erasure mechanism to get the + /// actual (erased) type. We erase ProvidedTypes to their base type + /// and we erase array of provided type to array of base type. In the + /// case of generics all the generic type arguments are also recursively + /// replaced with the erased-to types + static member EraseType : t:Type -> Type + /// A provided generated assembly type ProvidedAssembly = new : assemblyFileName:string -> ProvidedAssembly @@ -351,13 +405,17 @@ type ProvidedAssembly = type TypeProviderForNamespaces = /// Initializes a type provider to provide the types in the given namespace. - internal new : namespaceName:string * types: ProvidedTypeDefinition list -> TypeProviderForNamespaces + new : namespaceName:string * types: ProvidedTypeDefinition list -> TypeProviderForNamespaces /// Initializes a type provider - internal new : unit -> TypeProviderForNamespaces + new : unit -> TypeProviderForNamespaces /// Add a namespace of provided types. - member internal AddNamespace : namespaceName:string * types: ProvidedTypeDefinition list -> unit + member AddNamespace : namespaceName:string * types: ProvidedTypeDefinition list -> unit + + /// FSharp.Data addition: this method is used by Debug.fs + /// Get all namespace with their provided types. + member Namespaces : (string * ProvidedTypeDefinition list) seq with get /// Invalidate the information provided by the provider member Invalidate : unit -> unit @@ -372,6 +430,10 @@ type TypeProviderForNamespaces = member RegisterProbingFolder : folder : string -> unit /// Registers location of RuntimeAssembly (from TypeProviderConfig) as probing folder member RegisterRuntimeAssemblyLocationAsProbingFolder : cfg : Core.CompilerServices.TypeProviderConfig -> unit + #endif + [] + member Disposing : IEvent + interface ITypeProvider diff --git a/src/FSharp.Configuration/ResXProvider.fs b/src/FSharp.Configuration/ResXProvider.fs index 8b8fff87..697f6c8a 100644 --- a/src/FSharp.Configuration/ResXProvider.fs +++ b/src/FSharp.Configuration/ResXProvider.fs @@ -3,7 +3,7 @@ open System open System.IO open System.Reflection -open Samples.FSharp.ProvidedTypes +open ProviderImplementation.ProvidedTypes open FSharp.Configuration.Helper open System.Resources open System.ComponentModel.Design diff --git a/src/FSharp.Configuration/TypeProviders.Helper.fs b/src/FSharp.Configuration/TypeProviders.Helper.fs index 61a1e6d6..420f9c0b 100644 --- a/src/FSharp.Configuration/TypeProviders.Helper.fs +++ b/src/FSharp.Configuration/TypeProviders.Helper.fs @@ -4,7 +4,7 @@ module internal FSharp.Configuration.Helper open System open System.IO -open Samples.FSharp.ProvidedTypes +open ProviderImplementation.ProvidedTypes open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Core.Printf diff --git a/src/FSharp.Configuration/YamlConfigProvider.fs b/src/FSharp.Configuration/YamlConfigProvider.fs index 04666560..9692ceef 100644 --- a/src/FSharp.Configuration/YamlConfigProvider.fs +++ b/src/FSharp.Configuration/YamlConfigProvider.fs @@ -3,7 +3,7 @@ #nowarn "57" open System.Reflection -open Samples.FSharp.ProvidedTypes +open ProviderImplementation.ProvidedTypes open System open System.IO open SharpYaml.Serialization