Skip to content

Commit

Permalink
fix: remove warning about patter discard not allowed for union case t…
Browse files Browse the repository at this point in the history
…hat takes no data (#401)
  • Loading branch information
MangelMaxime authored Apr 20, 2024
1 parent 6149ed5 commit 3a9510e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/ProvidedTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7529,7 +7529,7 @@ namespace ProviderImplementation.ProvidedTypes
// See bug https://github.com/fsprojects/FSharp.TypeProviders.SDK/issues/236
override __.IsSZArray =
match kind with
| TypeSymbolKind.SDArray _ -> true
| TypeSymbolKind.SDArray -> true
| _ -> false
#endif
override this.GetMember(_name, _mt, _bindingFlags) = notRequired this "GetMember" this.Name
Expand Down Expand Up @@ -8342,16 +8342,16 @@ namespace ProviderImplementation.ProvidedTypes
// all `#r` implied by a load script. However until it is fixed we need to delay the recomputation
// of the referenced assemblies.
module private TypeProviderConfigFix =

let GetCurrentReferencedAssemblyPaths(config: TypeProviderConfig) : string array =

// Ideally this would always return the correct thing
let given = config.ReferencedAssemblies

#if DISABLE_TypeProviderConfigFix
given
#else
// We additionally scrape the config option in case any new references have been added
let GetCurrentReferencedAssemblyPaths(config: TypeProviderConfig) : string array =
// Ideally this would always return the correct thing
let given = config.ReferencedAssemblies

#if DISABLE_TypeProviderConfigFix
given
#else
// We additionally scrape the config option in case any new references have been added
let additional =
try

Expand Down Expand Up @@ -8947,7 +8947,7 @@ namespace ProviderImplementation.ProvidedTypes

//do System.Diagnostics.Debugger.Break()

let initialTargetAssemblyPaths = TypeProviderConfigFix.GetCurrentReferencedAssemblyPaths(config)
let initialTargetAssemblyPaths = TypeProviderConfigFix.GetCurrentReferencedAssemblyPaths(config)

/// Find which assembly defines System.Object etc.
let systemRuntimeScopeRef =
Expand Down Expand Up @@ -8999,18 +8999,18 @@ namespace ProviderImplementation.ProvidedTypes
let targetAssembliesTable_ = ConcurrentDictionary<string, Choice<Assembly, _>>()
let targetAssemblies_ = ResizeArray<Assembly>()
let targetAssembliesQueue = ResizeArray<_>()
let registerTargetAssemblyPaths (targetAssemblyPaths: string array) =
let registerTargetAssemblyPaths (targetAssemblyPaths: string array) =
targetAssembliesQueue.Add (fun () ->
for ref in targetAssemblyPaths do
let simpleName = Path.GetFileNameWithoutExtension ref
if not (targetAssembliesTable_.ContainsKey simpleName) then
if not (targetAssembliesTable_.ContainsKey simpleName) then
let reader = mkReader ref
targetAssembliesTable_.[simpleName] <- reader
match reader with
| Choice2Of2 _ -> ()
| Choice1Of2 asm -> targetAssemblies_.Add asm)

do registerTargetAssemblyPaths initialTargetAssemblyPaths
| Choice1Of2 asm -> targetAssemblies_.Add asm)
do registerTargetAssemblyPaths initialTargetAssemblyPaths

// We do a one-off registration of any additional target assemblies that are available in the compilation
// context once the type provider starts to be used in earnest, that is when the static parameters
Expand Down Expand Up @@ -9450,8 +9450,8 @@ namespace ProviderImplementation.ProvidedTypes
let backingDataSource = Some (checkFreshMethods, getFreshMethods, getFreshInterfaces, getFreshMethodOverrides)

let getStaticParameters() =
// By the time we are asked for static parameters, all DLLs will have been registered
registerAdditionalTargetAssembliesOnce.Force()
// By the time we are asked for static parameters, all DLLs will have been registered
registerAdditionalTargetAssembliesOnce.Force()
x.StaticParams |> List.map convStaticParameterDefToTgt

let applyStaticParameters =
Expand Down

0 comments on commit 3a9510e

Please sign in to comment.