@@ -1001,7 +1001,7 @@ let OutputPhasedErrorR (os:System.Text.StringBuilder) (err:PhasedError) =
10011001| Parser.NONTERM_ implementationFile| Parser.NONTERM_ fileNamespaceImpl| Parser.NONTERM_ fileNamespaceImpls-> Some()
10021002| _ -> None
10031003let (| NONTERM_Category_Definition | _ |) = function
1004- | Parser.NONTERM_ fileModuleImpl| Parser.NONTERM_ moduleDefn| Parser.NONTERM _ interactiveModuleDefns
1004+ | Parser.NONTERM_ fileModuleImpl| Parser.NONTERM_ moduleDefn| Parser.NONTERM _ interactiveDefns
10051005| Parser.NONTERM_ moduleDefns| Parser.NONTERM_ moduleDefnsOrExpr-> Some()
10061006| _ -> None
10071007
@@ -3767,19 +3767,25 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
37673767 tcGlobals<- Some g
37683768
37693769#if EXTENSIONTYPING
3770- member private tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment ( tcConfig : TcConfig ) m ( entity : Entity ) ( injectedNamspace , remainingNamespace ) provider ( st : Tainted < ProvidedType > option ) =
3770+ member private tcImports.InjectProvidedNamespaceOrTypeIntoEntity
3771+ ( typeProviderEnvironment ,
3772+ tcConfig : TcConfig ,
3773+ m , entity : Entity ,
3774+ injectedNamspace , remainingNamespace ,
3775+ provider ,
3776+ st : Tainted < ProvidedType > option ) =
37713777match remainingNamespacewith
37723778| next:: rest->
37733779// Inject the namespace entity
37743780match entity.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName.TryFind( next) with
37753781| Some childEntity->
3776- tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m childEntity( next:: injectedNamspace, rest) provider st
3782+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , childEntity, next:: injectedNamspace, rest, provider, st)
37773783| None->
37783784// Build up the artificial namespace if there is not a real one.
37793785let cpath = CompPath( ILScopeRef.Local, injectedNamspace|> List.rev|> List.map( fun n -> ( n, ModuleOrNamespaceKind.Namespace)) )
37803786let newNamespace = NewModuleOrNamespace( Some cpath) taccessPublic( ident( next, rangeStartup)) XmlDoc.Empty[] ( notlazy( NewEmptyModuleOrNamespaceType Namespace))
37813787 entity.ModuleOrNamespaceType.AddModuleOrNamespaceByMutation( newNamespace)
3782- tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m newNamespace( next:: injectedNamspace, rest) provider st
3788+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , newNamespace, next:: injectedNamspace, rest, provider, st)
37833789| [] ->
37843790match stwith
37853791| Some st->
@@ -3808,46 +3814,46 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38083814
38093815| _ -> failwith" Unexpected representation in namespace entity referred to by a type provider"
38103816
3811- member tcImports.ImportTypeProviderExtensions ( tpApprovalsRef : ApprovalIO.TypeProviderApprovalStatus list ref ,
3812- displayPSTypeProviderSecurityDialogBlockingUI ,
3813- tcConfig : TcConfig ,
3814- fileNameOfRuntimeAssembly ,
3815- ilScopeRefOfRuntimeAssembly ,
3816- moduleAttributes : ILAttribute list ,
3817- mspec ,
3818- invalidateCcu : Event < _ >,
3819- m ) =
3820-
3821- let typeProviderEnvironment : ExtensionTyping.ResolutionEnvironment =
3822- { resolutionFolder= tcConfig.implicitIncludeDir
3823- outputFile= tcConfig.outputFile
3824- showResolutionMessages= tcConfig.showExtensionTypeMessages
3825- referencedAssemblies= [| for rin resolutions.GetAssemblyResolutions() -> r.resolvedPath|]
3826- temporaryFolder= Path.GetTempPath()
3827- }
3817+ member tcImports.ImportTypeProviderExtensions
3818+ ( tpApprovals : ApprovalIO.TypeProviderApprovalStatus list ,
3819+ displayPSTypeProviderSecurityDialogBlockingUI ,
3820+ tcConfig : TcConfig ,
3821+ fileNameOfRuntimeAssembly ,
3822+ ilScopeRefOfRuntimeAssembly ,
3823+ runtimeAssemblyAttributes : ILAttribute list ,
3824+ entityToInjectInto , invalidateCcu : Event < _ >, m ) =
3825+
3826+ let startingErrorCount = CompileThreadStatic.ErrorLogger.ErrorCount
38283827
38293828// Find assembly level TypeProviderAssemblyAttributes. These will point to the assemblies that
38303829// have class which implement ITypeProvider and which have TypeProviderAttribute on them.
3831- let startingErrorCount = CompileThreadStatic.ErrorLogger.ErrorCount
38323830let providerAssemblies =
3833- moduleAttributes
3831+ runtimeAssemblyAttributes
38343832|> List.choose( TryDecodeTypeProviderAssemblyAttr( defaultArg ilGlobalsOpt EcmaILGlobals))
38353833// If no design-time assembly is specified, use the runtime assembly
38363834|> List.map( function null -> Path.GetFileNameWithoutExtension fileNameOfRuntimeAssembly| s-> s)
38373835|> Set.ofList
38383836
38393837if providerAssemblies.Count> 0 then
38403838
3841- let systemRuntimeAssemblyVersion : System.Version =
3839+ // Find the SystemRuntimeAssemblyVersion value to report in the TypeProviderConfig.
3840+ let systemRuntimeAssemblyVersion =
38423841let primaryAssemblyRef = tcConfig.PrimaryAssemblyDllReference()
38433842let resolution = tcConfig.ResolveLibWithDirectories CcuLoadFailureAction.RaiseError primaryAssemblyRef|> Option.get
38443843// MSDN: this method causes the file to be opened and closed, but the assembly is not added to this domain
38453844let name = System.Reflection.AssemblyName.GetAssemblyName( resolution.resolvedPath)
38463845 name.Version
38473846
3847+ let typeProviderEnvironment =
3848+ { resolutionFolder= tcConfig.implicitIncludeDir
3849+ outputFile= tcConfig.outputFile
3850+ showResolutionMessages= tcConfig.showExtensionTypeMessages
3851+ referencedAssemblies= [| for rin resolutions.GetAssemblyResolutions() -> r.resolvedPath|]
3852+ temporaryFolder= Path.GetTempPath() }
3853+
38483854let providers =
38493855[ for assemblyNamein providerAssembliesdo
3850- yield ExtensionTyping.GetTypeProvidersOfAssembly( displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders, tpApprovalsRef ,
3856+ yield ExtensionTyping.GetTypeProvidersOfAssembly( displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders, tpApprovals ,
38513857 fileNameOfRuntimeAssembly, ilScopeRefOfRuntimeAssembly, assemblyName, typeProviderEnvironment,
38523858 tcConfig.isInvalidationSupported, tcConfig.isInteractive, tcImports.SystemRuntimeContainsType, systemRuntimeAssemblyVersion, m) ]
38533859let wasApproved = providers|> List.forall( fun ( ok , _ ) -> ok)
@@ -3881,8 +3887,8 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38813887// Inject an entity for the namespace, or if one already exists, then record this as a provider
38823888// for that namespace.
38833889let rec loop ( providedNamespace : Tainted < IProvidedNamespace >) =
3884- let path = ExtensionTyping.GetPartsOfDotNetNamespace ( m, provider, providedNamespace.PUntaint(( fun r -> r.NamespaceName), m))
3885- tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m mspec ( [], path) provider None
3890+ let path = ExtensionTyping.GetProvidedNamespaceAsPath ( m, provider, providedNamespace.PUntaint(( fun r -> r.NamespaceName), m))
3891+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , entityToInjectInto , [], path, provider, None)
38863892
38873893// Inject entities for the types returned by provider.GetTypes().
38883894//
@@ -3892,7 +3898,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38923898let tys = providedNamespace.PApplyArray(( fun provider -> provider.GetTypes()), " GetTypes" , m)
38933899let ptys = [| for tyin tys-> ty.PApply(( fun ty -> ty|> ProvidedType.CreateNoContext), m) |]
38943900for stin ptysdo
3895- tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m mspec ( [], path) provider( Some st)
3901+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , entityToInjectInto , [], path, provider, Some st)
38963902
38973903for providedNestedNamespacein providedNamespace.PApplyArray(( fun provider -> provider.GetNestedNamespaces()), " GetNestedNamespaces" , m) do
38983904 loop providedNestedNamespace
@@ -3923,7 +3929,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
39233929// Compact Framework binaries must use this. However it is not
39243930// clear when else it is required, e.g. for Mono.
39253931
3926- member tcImports.PrepareToImportReferencedIlDll tpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
3932+ member tcImports.PrepareToImportReferencedIlDll tpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
39273933 CheckDisposed()
39283934let tcConfig = tcConfigP.Get()
39293935 tcConfig.CheckFSharpBinary( filename, dllinfo.ILAssemblyRefs, m)
@@ -3955,12 +3961,12 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
39553961 tcImports.RegisterCcu( ccuinfo);
39563962let phase2 () =
39573963#if EXTENSIONTYPING
3958- ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovalsRef , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
3964+ ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovals , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
39593965#endif
39603966[ ResolvedImportedAssembly( ccuinfo)]
39613967 phase2
39623968
3963- member tcImports.PrepareToImportReferencedFSharpDll tpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
3969+ member tcImports.PrepareToImportReferencedFSharpDll tpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
39643970 CheckDisposed()
39653971let tcConfig = tcConfigP.Get()
39663972 tcConfig.CheckFSharpBinary( filename, dllinfo.ILAssemblyRefs, m)
@@ -4080,7 +4086,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
40804086 ILScopeRef= ilScopeRef}
40814087let phase2 () =
40824088#if EXTENSIONTYPING
4083- ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovalsRef , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
4089+ ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovals , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
40844090#else
40854091()
40864092#endif
@@ -4099,7 +4105,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
40994105 phase2
41004106
41014107
4102- member tcImports.RegisterAndPrepareToImportReferencedDll tpApprovalsRef displayPSTypeProviderSecurityDialogBlockingUI( r : AssemblyResolution ) : _ *( unit -> AvailableImportedAssembly list )=
4108+ member tcImports.RegisterAndPrepareToImportReferencedDll tpApprovals displayPSTypeProviderSecurityDialogBlockingUI( r : AssemblyResolution ) : _ *( unit -> AvailableImportedAssembly list )=
41034109 CheckDisposed()
41044110let m = r.originalReference.Range
41054111let filename = r.resolvedPath
@@ -4128,28 +4134,28 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
41284134if ( List.exists IsSignatureDataVersionAttr attrs) then
41294135if not ( List.exists( IsMatchingSignatureDataVersionAttr ilg( IL.parseILVersion Internal.Utilities.FSharpEnvironment.FSharpBinaryMetadataFormatRevision)) attrs) then
41304136 errorR( Error( FSComp.SR.buildDifferentVersionMustRecompile( filename), m))
4131- tcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4137+ tcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41324138else
41334139try
4134- tcImports.PrepareToImportReferencedFSharpDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4140+ tcImports.PrepareToImportReferencedFSharpDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41354141with e-> error( Error( FSComp.SR.buildErrorOpeningBinaryFile( filename, e.Message), m))
41364142else
4137- tcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4143+ tcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41384144 dllinfo, phase2
41394145
41404146member tcImports.RegisterAndImportReferencedAssemblies ( displayPSTypeProviderSecurityDialogBlockingUI , nms : AssemblyResolution list ) =
41414147 CheckDisposed()
41424148
41434149#if EXTENSIONTYPING
4144- let tpApprovalsRef = ref ( ExtensionTyping.ApprovalIO.readApprovalsFile ( None) )
4150+ let tpApprovals = ExtensionTyping.ApprovalIO.ReadApprovalsFile ( None)
41454151#else
4146- let tpApprovalsRef = ref ([])
4152+ let tpApprovals = []
41474153#endif
41484154let dllinfos , phase2s =
41494155 nms|> List.map
41504156( fun nm ->
41514157try
4152- tcImports.RegisterAndPrepareToImportReferencedDlltpApprovalsRef displayPSTypeProviderSecurityDialogBlockingUI nm
4158+ tcImports.RegisterAndPrepareToImportReferencedDlltpApprovals displayPSTypeProviderSecurityDialogBlockingUI nm
41534159with e->
41544160 error( Error( FSComp.SR.buildProblemReadingAssembly( nm.fusionName, e.Message), nm.originalReference.Range)))
41554161|> List.unzip