Skip to content

Commit

Permalink
Merge branch 'main' into provided-types-update
Browse files Browse the repository at this point in the history
# Conflicts:
#	paket.lock
  • Loading branch information
Thorium committed Nov 21, 2023
2 parents 7792f38 + 937980c commit efc6ab4
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 23 deletions.
4 changes: 2 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fsi
github fsprojects/FSharp.TypeProviders.SDK src/ProvidedTypes.fs
github fsprojects/FSharp.TypeProviders.SDK tests/ProvidedTypesTesting.fs

nuget FSharp.Core >= 5.0.1 lowest_matching: true
nuget FSharp.Core >= 6.0.1 lowest_matching: true
nuget Microsoft.SourceLink.GitHub 1.0 copy_local: true
nuget Microsoft.SourceLink.Common 1.0 copy_local: true
nuget Microsoft.Build.Tasks.Git 1.0 copy_local: true
Expand Down Expand Up @@ -49,7 +49,7 @@ group Test
frameworks: net6.0
source https://api.nuget.org/v3/index.json

nuget FSharp.Core 5.0.1
nuget FSharp.Core 6.0.1
nuget Microsoft.NET.Test.Sdk
nuget NUnit 3.13.1
nuget NUnit3TestAdapter
Expand Down
4 changes: 2 additions & 2 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RESTRICTION: || (== net6.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (5.0.1)
FSharp.Core (6.0.1)
Microsoft.Build.Tasks.Git (1.0) - copy_local: true
Microsoft.NETCore.App (2.2.8)
Microsoft.NETCore.DotNetHostPolicy (>= 2.2.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp2.2))
Expand Down Expand Up @@ -340,7 +340,7 @@ NUGET
remote: https://api.nuget.org/v3/index.json
FsCheck (2.15.1)
FSharp.Core (>= 4.2.3)
FSharp.Core (5.0.1)
FSharp.Core (6.0.1)
FsUnit (4.0.4)
FSharp.Core (>= 4.3.4)
NETStandard.Library (>= 2.0.3)
Expand Down
3 changes: 1 addition & 2 deletions src/FSharp.Data.Runtime.Utilities/Caching.fs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ let createInMemoryCache (expiration: TimeSpan) =
/// Get hash code of a string - used to determine cache file
let private hashString (plainText: string) =
let plainTextBytes = Encoding.UTF8.GetBytes(plainText)
let hash = new SHA1Managed()
let hashBytes = hash.ComputeHash(plainTextBytes)
let hashBytes = SHA1.Create().ComputeHash(plainTextBytes)
let s = Convert.ToBase64String(hashBytes)
s.Replace("ab", "abab").Replace("\\", "ab")

Expand Down
1 change: 1 addition & 0 deletions src/FSharp.Data.Runtime.Utilities/IO.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ open System.IO
open System.Text
open FSharp.Data

[<Struct>]
type internal UriResolutionType =
| DesignTime
| Runtime
Expand Down
19 changes: 13 additions & 6 deletions src/FSharp.Data.Runtime.Utilities/NameUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,29 @@ open FSharp.Data.Runtime
// Active patterns & operators for parsing strings

let private tryAt (s: string) i =
if i >= s.Length then None else Some s.[i]
if i >= s.Length then ValueNone else ValueSome s.[i]

let private sat f (c: option<char>) =
let private sat f (c: voption<char>) =
match c with
| Some c when f c -> Some c
| _ -> None
| ValueSome c when f c -> ValueSome c
| _ -> ValueNone

[<return: Struct>]
let private (|EOF|_|) c =
match c with
| Some _ -> None
| _ -> Some()
| ValueSome _ -> ValueNone
| _ -> ValueSome()

[<return: Struct>]
let private (|LetterDigit|_|) = sat Char.IsLetterOrDigit

[<return: Struct>]
let private (|Upper|_|) = sat (fun c -> Char.IsUpper c || Char.IsDigit c)

[<return: Struct>]
let private (|Lower|_|) = sat (fun c -> Char.IsLower c || Char.IsDigit c)


// --------------------------------------------------------------------------------------

/// Turns a given non-empty string into a nice 'PascalCase' identifier
Expand Down
3 changes: 2 additions & 1 deletion src/FSharp.Data.Runtime.Utilities/StructuralInference.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ open FSharp.Data.Runtime.StructuralTypes
open System.Text.RegularExpressions

/// This is the internal DU representing all the valid cases we support, mapped from the public InferenceMode.
[<Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
[<Struct;
Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
type InferenceMode' =
| NoInference
/// Backward compatible mode.
Expand Down
14 changes: 9 additions & 5 deletions src/FSharp.Data.Runtime.Utilities/StructuralTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ type InferedProperty =
/// For heterogeneous types (types that have multiple possible forms
/// such as differently named XML nodes or records and arrays mixed together)
/// this type represents the number of occurrences of individual forms
[<Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
[<Struct;
Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
type InferedMultiplicity =
| Single
| OptionalSingle
Expand Down Expand Up @@ -188,23 +189,26 @@ type internal InferedTypeTag with

/// Dummy type to represent that only "0" was found.
/// Will be generated as 'int', unless it's converted to Bit.
[<Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
[<Struct;
Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
type Bit0 = Bit0

/// Dummy type to represent that only "1" was found
/// Will be generated as 'int', unless it's converted to Bit
[<Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
[<Struct;
Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
type Bit1 = Bit1

/// Dummy type to represent that only one of "0" and "1" were found
/// Will be generated as a 'bool', unless it's converted to another numerical type
[<Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
[<Struct;
Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
type Bit = Bit

// ------------------------------------------------------------------------------------------------

/// Represents a transformation of a type
[<RequireQualifiedAccess>]
[<Struct; RequireQualifiedAccess>]
[<Obsolete("This API will be made internal in a future release. Please file an issue at https://github.com/fsprojects/FSharp.Data/issues/1458 if you need this public.")>]
type TypeWrapper =
/// No transformation will be made to the type
Expand Down
10 changes: 6 additions & 4 deletions src/FSharp.Data.Runtime.Utilities/TextConversions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ module private Helpers =
| true, v -> Some v
| _ -> None

[<return: Struct>]
let (|StringEqualsIgnoreCase|_|) (s1: string) s2 =
if s1.Equals(s2, StringComparison.OrdinalIgnoreCase) then
Some()
ValueSome()
else
None
ValueNone

[<return: Struct>]
let (|OneOfIgnoreCase|_|) set str =
if Array.exists (fun s -> StringComparer.OrdinalIgnoreCase.Compare(s, str) = 0) set then
Some()
ValueSome()
else
None
ValueNone

// note on the regex we have /Date()/ and not \/Date()\/ because the \/ escaping
// is already taken care of before AsDateTime is called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
<ProjectReference Include="..\..\src\FSharp.Data.Html.Core\FSharp.Data.Html.Core.fsproj" />
<ProjectReference Include="..\..\src\FSharp.Data.WorldBank.Core\FSharp.Data.WorldBank.Core.fsproj" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.1" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
3 changes: 3 additions & 0 deletions tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
<ProjectReference Include="..\..\src\FSharp.Data.Html.Core\FSharp.Data.Html.Core.fsproj" />
<ProjectReference Include="..\..\src\FSharp.Data.WorldBank.Core\FSharp.Data.WorldBank.Core.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.1" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<Compile Include="SignatureTests.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\FSharp.Data.DesignTime\FSharp.Data.DesignTime.fsproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<ItemGroup>
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FSharp.Data.Tests\FSharp.Data.Tests.fsproj" />
</ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions tests/FSharp.Data.Tests/FSharp.Data.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@
<ItemGroup>
<ProjectReference Include="..\..\src\FSharp.Data\FSharp.Data.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.1" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

0 comments on commit efc6ab4

Please sign in to comment.