Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[automated] Merge branch 'main' => 'release/dev17.14' #18272

Open
wants to merge 7 commits into
base: release/dev17.14
Choose a base branch
from
Prev Previous commit
Next Next commit
Replace internal option–voption conversions with FSharp.Core funcs (#…
  • Loading branch information
brianrourkeboll authored Jan 27, 2025
commit 013c9982b7d1de552975f4efee71ccfdde98aed6
5 changes: 0 additions & 5 deletions src/Compiler/Service/IncrementalBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ type TcInfoExtras =
member x.TcSymbolUses =
x.tcSymbolUses

module ValueOption =
let toOption = function
| ValueSome x -> Some x
| _ -> None

type private SingleFileDiagnostics = (PhasedDiagnostic * FSharpDiagnosticSeverity) array
type private TypeCheck = TcInfo * TcResultsSinkImpl * CheckedImplFile option * string * SingleFileDiagnostics

Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/TypedTree/TypedTree.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ type ModuleOrNamespaceType(kind: ModuleOrNamespaceKind, vals: QueueList<Val>, en
|> List.tryFind (fun v -> match key.TypeForLinkage with
| None -> true
| Some keyTy -> ccu.MemberSignatureEquality(keyTy, v.Type))
|> ValueOptionInternal.ofOption
|> ValueOption.ofOption

/// Get a table of values indexed by logical name
member _.AllValsByLogicalName =
Expand Down Expand Up @@ -4237,7 +4237,7 @@ type UnionCaseRef =
/// Try to dereference the reference
member x.TryUnionCase =
x.TyconRef.TryDeref
|> ValueOptionInternal.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOptionInternal.ofOption)
|> ValueOption.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOption.ofOption)

/// Get the attributes associated with the union case
member x.Attribs = x.UnionCase.Attribs
Expand Down Expand Up @@ -4300,7 +4300,7 @@ type RecdFieldRef =
/// Try to dereference the reference
member x.TryRecdField =
x.TyconRef.TryDeref
|> ValueOptionInternal.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOptionInternal.ofOption)
|> ValueOption.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOption.ofOption)

/// Get the attributes associated with the compiled property of the record field
member x.PropertyAttribs = x.RecdField.PropertyAttribs
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3526,11 +3526,11 @@ let IsMatchingFSharpAttributeOpt g attrOpt (Attrib(tcref2, _, _, _, _, _, _)) =

[<return: Struct>]
let (|ExtractAttribNamedArg|_|) nm args =
args |> List.tryPick (function AttribNamedArg(nm2, _, _, v) when nm = nm2 -> Some v | _ -> None) |> ValueOptionInternal.ofOption
args |> List.tryPick (function AttribNamedArg(nm2, _, _, v) when nm = nm2 -> Some v | _ -> None) |> ValueOption.ofOption

[<return: Struct>]
let (|ExtractILAttributeNamedArg|_|) nm (args: ILAttributeNamedArg list) =
args |> List.tryPick (function nm2, _, _, v when nm = nm2 -> Some v | _ -> None) |> ValueOptionInternal.ofOption
args |> List.tryPick (function nm2, _, _, v when nm = nm2 -> Some v | _ -> None) |> ValueOption.ofOption

[<return: Struct>]
let (|StringExpr|_|) = function Expr.Const (Const.String n, _, _) -> ValueSome n | _ -> ValueNone
Expand Down
12 changes: 0 additions & 12 deletions src/Compiler/Utilities/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -715,18 +715,6 @@ module Span =

state

module ValueOptionInternal =

let inline ofOption x =
match x with
| Some x -> ValueSome x
| None -> ValueNone

let inline bind ([<InlineIfLambda>] f) x =
match x with
| ValueSome x -> f x
| ValueNone -> ValueNone

module String =
let make (n: int) (c: char) : string = String(c, n)

Expand Down
6 changes: 0 additions & 6 deletions src/Compiler/Utilities/illib.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ module internal ResizeArray =
module internal Span =
val inline exists: predicate: ('T -> bool) -> span: Span<'T> -> bool

module internal ValueOptionInternal =

val inline ofOption: x: 'a option -> 'a voption

val inline bind: f: ('a -> 'b voption) -> x: 'a voption -> 'b voption

module internal String =

val make: n: int -> c: char -> string
Expand Down
13 changes: 0 additions & 13 deletions vsintegration/src/FSharp.Editor/Common/Extensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,6 @@ module Option =
else
None

[<RequireQualifiedAccess>]
module ValueOption =

let inline ofOption o =
match o with
| Some v -> ValueSome v
| _ -> ValueNone

let inline toOption o =
match o with
| ValueSome v -> Some v
| _ -> None

[<RequireQualifiedAccess>]
module IEnumerator =
let chooseV f (e: IEnumerator<'T>) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ type Mode =
| WithSettings of CodeFixesOptions

module ValueOption =
let inline toOption o =
match o with
| ValueSome v -> Some v
| _ -> None

let inline ofOption o =
match o with
| Some v -> ValueSome v
| _ -> ValueNone

let inline either f y o =
match o with
| ValueSome v -> f v
Expand Down