@@ -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 _ interactiveDefns
1004+ | Parser.NONTERM_ fileModuleImpl| Parser.NONTERM_ moduleDefn| Parser.NONTERM _ interactiveModuleDefns
10051005| Parser.NONTERM_ moduleDefns| Parser.NONTERM_ moduleDefnsOrExpr-> Some()
10061006| _ -> None
10071007
@@ -3767,25 +3767,19 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
37673767 tcGlobals<- Some g
37683768
37693769#if EXTENSIONTYPING
3770- member private tcImports.InjectProvidedNamespaceOrTypeIntoEntity
3771- ( typeProviderEnvironment ,
3772- tcConfig : TcConfig ,
3773- m , entity : Entity ,
3774- injectedNamspace , remainingNamespace ,
3775- provider ,
3776- st : Tainted < ProvidedType > option ) =
3770+ member private tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment ( tcConfig : TcConfig ) m ( entity : Entity ) ( injectedNamspace , remainingNamespace ) provider ( st : Tainted < ProvidedType > option ) =
37773771match remainingNamespacewith
37783772| next:: rest->
37793773// Inject the namespace entity
37803774match entity.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName.TryFind( next) with
37813775| Some childEntity->
3782- tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , childEntity, next:: injectedNamspace, rest, provider, st)
3776+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m childEntity( next:: injectedNamspace, rest) provider st
37833777| None->
37843778// Build up the artificial namespace if there is not a real one.
37853779let cpath = CompPath( ILScopeRef.Local, injectedNamspace|> List.rev|> List.map( fun n -> ( n, ModuleOrNamespaceKind.Namespace)) )
37863780let newNamespace = NewModuleOrNamespace( Some cpath) taccessPublic( ident( next, rangeStartup)) XmlDoc.Empty[] ( notlazy( NewEmptyModuleOrNamespaceType Namespace))
37873781 entity.ModuleOrNamespaceType.AddModuleOrNamespaceByMutation( newNamespace)
3788- tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , newNamespace, next:: injectedNamspace, rest, provider, st)
3782+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m newNamespace( next:: injectedNamspace, rest) provider st
37893783| [] ->
37903784match stwith
37913785| Some st->
@@ -3814,46 +3808,46 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38143808
38153809| _ -> failwith" Unexpected representation in namespace entity referred to by a type provider"
38163810
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
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+ }
38273828
38283829// Find assembly level TypeProviderAssemblyAttributes. These will point to the assemblies that
38293830// have class which implement ITypeProvider and which have TypeProviderAttribute on them.
3831+ let startingErrorCount = CompileThreadStatic.ErrorLogger.ErrorCount
38303832let providerAssemblies =
3831- runtimeAssemblyAttributes
3833+ moduleAttributes
38323834|> List.choose( TryDecodeTypeProviderAssemblyAttr( defaultArg ilGlobalsOpt EcmaILGlobals))
38333835// If no design-time assembly is specified, use the runtime assembly
38343836|> List.map( function null -> Path.GetFileNameWithoutExtension fileNameOfRuntimeAssembly| s-> s)
38353837|> Set.ofList
38363838
38373839if providerAssemblies.Count> 0 then
38383840
3839- // Find the SystemRuntimeAssemblyVersion value to report in the TypeProviderConfig.
3840- let systemRuntimeAssemblyVersion =
3841+ let systemRuntimeAssemblyVersion : System.Version =
38413842let primaryAssemblyRef = tcConfig.PrimaryAssemblyDllReference()
38423843let resolution = tcConfig.ResolveLibWithDirectories CcuLoadFailureAction.RaiseError primaryAssemblyRef|> Option.get
38433844// MSDN: this method causes the file to be opened and closed, but the assembly is not added to this domain
38443845let name = System.Reflection.AssemblyName.GetAssemblyName( resolution.resolvedPath)
38453846 name.Version
38463847
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-
38543848let providers =
38553849[ for assemblyNamein providerAssembliesdo
3856- yield ExtensionTyping.GetTypeProvidersOfAssembly( displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders, tpApprovals ,
3850+ yield ExtensionTyping.GetTypeProvidersOfAssembly( displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders, tpApprovalsRef ,
38573851 fileNameOfRuntimeAssembly, ilScopeRefOfRuntimeAssembly, assemblyName, typeProviderEnvironment,
38583852 tcConfig.isInvalidationSupported, tcConfig.isInteractive, tcImports.SystemRuntimeContainsType, systemRuntimeAssemblyVersion, m) ]
38593853let wasApproved = providers|> List.forall( fun ( ok , _ ) -> ok)
@@ -3887,8 +3881,8 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38873881// Inject an entity for the namespace, or if one already exists, then record this as a provider
38883882// for that namespace.
38893883let rec loop ( providedNamespace : Tainted < IProvidedNamespace >) =
3890- let path = ExtensionTyping.GetProvidedNamespaceAsPath ( m, provider, providedNamespace.PUntaint(( fun r -> r.NamespaceName), m))
3891- tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , entityToInjectInto , [], path, provider, None)
3884+ let path = ExtensionTyping.GetPartsOfDotNetNamespace ( m, provider, providedNamespace.PUntaint(( fun r -> r.NamespaceName), m))
3885+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m mspec ( [], path) provider None
38923886
38933887// Inject entities for the types returned by provider.GetTypes().
38943888//
@@ -3898,7 +3892,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38983892let tys = providedNamespace.PApplyArray(( fun provider -> provider.GetTypes()), " GetTypes" , m)
38993893let ptys = [| for tyin tys-> ty.PApply(( fun ty -> ty|> ProvidedType.CreateNoContext), m) |]
39003894for stin ptysdo
3901- tcImports.InjectProvidedNamespaceOrTypeIntoEntity( typeProviderEnvironment, tcConfig, m , entityToInjectInto , [], path, provider, Some st)
3895+ tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m mspec ( [], path) provider( Some st)
39023896
39033897for providedNestedNamespacein providedNamespace.PApplyArray(( fun provider -> provider.GetNestedNamespaces()), " GetNestedNamespaces" , m) do
39043898 loop providedNestedNamespace
@@ -3929,7 +3923,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
39293923// Compact Framework binaries must use this. However it is not
39303924// clear when else it is required, e.g. for Mono.
39313925
3932- member tcImports.PrepareToImportReferencedIlDll tpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
3926+ member tcImports.PrepareToImportReferencedIlDll tpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
39333927 CheckDisposed()
39343928let tcConfig = tcConfigP.Get()
39353929 tcConfig.CheckFSharpBinary( filename, dllinfo.ILAssemblyRefs, m)
@@ -3961,12 +3955,12 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
39613955 tcImports.RegisterCcu( ccuinfo);
39623956let phase2 () =
39633957#if EXTENSIONTYPING
3964- ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovals , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
3958+ ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovalsRef , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
39653959#endif
39663960[ ResolvedImportedAssembly( ccuinfo)]
39673961 phase2
39683962
3969- member tcImports.PrepareToImportReferencedFSharpDll tpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
3963+ member tcImports.PrepareToImportReferencedFSharpDll tpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI( dllinfo : ImportedBinary ) =
39703964 CheckDisposed()
39713965let tcConfig = tcConfigP.Get()
39723966 tcConfig.CheckFSharpBinary( filename, dllinfo.ILAssemblyRefs, m)
@@ -4086,7 +4080,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
40864080 ILScopeRef= ilScopeRef}
40874081let phase2 () =
40884082#if EXTENSIONTYPING
4089- ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovals , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
4083+ ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions( tpApprovalsRef , displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
40904084#else
40914085()
40924086#endif
@@ -4105,7 +4099,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
41054099 phase2
41064100
41074101
4108- member tcImports.RegisterAndPrepareToImportReferencedDll tpApprovals displayPSTypeProviderSecurityDialogBlockingUI( r : AssemblyResolution ) : _ *( unit -> AvailableImportedAssembly list )=
4102+ member tcImports.RegisterAndPrepareToImportReferencedDll tpApprovalsRef displayPSTypeProviderSecurityDialogBlockingUI( r : AssemblyResolution ) : _ *( unit -> AvailableImportedAssembly list )=
41094103 CheckDisposed()
41104104let m = r.originalReference.Range
41114105let filename = r.resolvedPath
@@ -4134,28 +4128,28 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
41344128if ( List.exists IsSignatureDataVersionAttr attrs) then
41354129if not ( List.exists( IsMatchingSignatureDataVersionAttr ilg( IL.parseILVersion Internal.Utilities.FSharpEnvironment.FSharpBinaryMetadataFormatRevision)) attrs) then
41364130 errorR( Error( FSComp.SR.buildDifferentVersionMustRecompile( filename), m))
4137- tcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4131+ tcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41384132else
41394133try
4140- tcImports.PrepareToImportReferencedFSharpDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4134+ tcImports.PrepareToImportReferencedFSharpDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41414135with e-> error( Error( FSComp.SR.buildErrorOpeningBinaryFile( filename, e.Message), m))
41424136else
4143- tcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4137+ tcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41444138 dllinfo, phase2
41454139
41464140member tcImports.RegisterAndImportReferencedAssemblies ( displayPSTypeProviderSecurityDialogBlockingUI , nms : AssemblyResolution list ) =
41474141 CheckDisposed()
41484142
41494143#if EXTENSIONTYPING
4150- let tpApprovals = ExtensionTyping.ApprovalIO.ReadApprovalsFile ( None)
4144+ let tpApprovalsRef = ref ( ExtensionTyping.ApprovalIO.readApprovalsFile ( None) )
41514145#else
4152- let tpApprovals = []
4146+ let tpApprovalsRef = ref ([])
41534147#endif
41544148let dllinfos , phase2s =
41554149 nms|> List.map
41564150( fun nm ->
41574151try
4158- tcImports.RegisterAndPrepareToImportReferencedDlltpApprovals displayPSTypeProviderSecurityDialogBlockingUI nm
4152+ tcImports.RegisterAndPrepareToImportReferencedDlltpApprovalsRef displayPSTypeProviderSecurityDialogBlockingUI nm
41594153with e->
41604154 error( Error( FSComp.SR.buildProblemReadingAssembly( nm.fusionName, e.Message), nm.originalReference.Range)))
41614155|> List.unzip