diff --git a/src/FSharp.Data.Csv.Core/CsvInference.fs b/src/FSharp.Data.Csv.Core/CsvInference.fs index b15804e46..b9e5d28de 100644 --- a/src/FSharp.Data.Csv.Core/CsvInference.fs +++ b/src/FSharp.Data.Csv.Core/CsvInference.fs @@ -500,6 +500,7 @@ type CsvFile with /// - Assumes all columns can have missing values /// - when set to true, inference will prefer to use the option type instead of nullable types, double.NaN or "" for missing values /// - optional function to resolve Units of Measure + /// - how to infer types: from values only, from values and units, or not at all member internal x.InferColumnTypes ( inferRows, diff --git a/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs b/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs index b4d192b73..958e2f484 100644 --- a/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs +++ b/src/FSharp.Data.DesignTime/CommonProviderImplementation/Helpers.fs @@ -257,7 +257,10 @@ module internal ProviderHelpers = match Uri.TryCreate(str, UriKind.RelativeOrAbsolute) with | false, _ -> None | true, uri -> - if str.Trim() = "" || not uri.IsAbsoluteUri && Seq.exists invalidChars.Contains str then + if + String.IsNullOrWhiteSpace str + || not uri.IsAbsoluteUri && Seq.exists invalidChars.Contains str + then None else Some uri diff --git a/src/FSharp.Data.Html.Core/HtmlOperations.fs b/src/FSharp.Data.Html.Core/HtmlOperations.fs index 4f6fb3246..9d10e29f8 100644 --- a/src/FSharp.Data.Html.Core/HtmlOperations.fs +++ b/src/FSharp.Data.Html.Core/HtmlOperations.fs @@ -69,22 +69,26 @@ module HtmlNode = n |> elements |> List.filter (name >> nameSet.Contains) let private descendantsBy includeSelf recurseOnMatch predicate n = - let rec descendantsBy includeSelf n = - seq { - let proceed = ref true + // one sequence with an explicit stack: pre-order, children in + // document order (pushed reversed), no enumerator per level + seq { + let stack = System.Collections.Generic.Stack() + stack.Push((n, includeSelf)) - if includeSelf && predicate n then - yield n + while stack.Count > 0 do + let node, considerSelf = stack.Pop() + let mutable proceed = true - if not recurseOnMatch then - proceed := false + if considerSelf && predicate node then + yield node - if !proceed then - for element in elements n do - yield! descendantsBy true element - } + if not recurseOnMatch then + proceed <- false - descendantsBy includeSelf n + if proceed then + for element in List.rev (elements node) do + stack.Push((element, true)) + } /// /// Gets all of the descendants of this node that statisfy the given predicate @@ -235,7 +239,7 @@ module HtmlNode = /// Returns true if the current node has the specified name let inline hasName (expectedName: string) n = - name n = expectedName.ToLowerInvariant() + String.Equals(name n, expectedName, StringComparison.OrdinalIgnoreCase) /// Returns true if the current node has the specified id let inline hasId id n = hasAttribute "id" id n diff --git a/src/FSharp.Data.Json.Core/JsonSchema.fs b/src/FSharp.Data.Json.Core/JsonSchema.fs index a25083e50..bf4ce5bb7 100644 --- a/src/FSharp.Data.Json.Core/JsonSchema.fs +++ b/src/FSharp.Data.Json.Core/JsonSchema.fs @@ -334,7 +334,7 @@ module JsonSchema = match Array.tryFind (fun (name, _) -> name = parts.[0]) fields with | Some(_, value) -> navigate value parts.[1..] | None -> failwith $"Reference part '{parts.[0]}' not found" - | _ -> failwith "Invalid reference path" + | _ -> failwith $"Invalid reference path: '{path}' does not lead through a record" let referencedValue = navigate rootSchema parts parseSchema referencedValue