Skip to content

Commit f4ca9f4

Browse files
Replace internal copies with FSharp.Core funcs
1 parent 59fd141 commit f4ca9f4

File tree

7 files changed

+4
-50
lines changed

7 files changed

+4
-50
lines changed

src/Compiler/Service/IncrementalBuild.fs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ type TcInfoExtras =
229229
member x.TcSymbolUses =
230230
x.tcSymbolUses
231231

232-
module ValueOption =
233-
let toOption = function
234-
| ValueSome x -> Some x
235-
| _ -> None
236-
237232
type private SingleFileDiagnostics = (PhasedDiagnostic * FSharpDiagnosticSeverity) array
238233
type private TypeCheck = TcInfo * TcResultsSinkImpl * CheckedImplFile option * string * SingleFileDiagnostics
239234

src/Compiler/TypedTree/TypedTree.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ type ModuleOrNamespaceType(kind: ModuleOrNamespaceKind, vals: QueueList<Val>, en
21172117
|> List.tryFind (fun v -> match key.TypeForLinkage with
21182118
| None -> true
21192119
| Some keyTy -> ccu.MemberSignatureEquality(keyTy, v.Type))
2120-
|> ValueOptionInternal.ofOption
2120+
|> ValueOption.ofOption
21212121

21222122
/// Get a table of values indexed by logical name
21232123
member _.AllValsByLogicalName =
@@ -4229,7 +4229,7 @@ type UnionCaseRef =
42294229
/// Try to dereference the reference
42304230
member x.TryUnionCase =
42314231
x.TyconRef.TryDeref
4232-
|> ValueOptionInternal.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOptionInternal.ofOption)
4232+
|> ValueOption.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOption.ofOption)
42334233

42344234
/// Get the attributes associated with the union case
42354235
member x.Attribs = x.UnionCase.Attribs
@@ -4292,7 +4292,7 @@ type RecdFieldRef =
42924292
/// Try to dereference the reference
42934293
member x.TryRecdField =
42944294
x.TyconRef.TryDeref
4295-
|> ValueOptionInternal.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOptionInternal.ofOption)
4295+
|> ValueOption.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOption.ofOption)
42964296

42974297
/// Get the attributes associated with the compiled property of the record field
42984298
member x.PropertyAttribs = x.RecdField.PropertyAttribs

src/Compiler/TypedTree/TypedTreeOps.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3474,7 +3474,7 @@ let IsMatchingFSharpAttributeOpt g attrOpt (Attrib(tcref2, _, _, _, _, _, _)) =
34743474

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

34793479
[<return: Struct>]
34803480
let (|StringExpr|_|) = function Expr.Const (Const.String n, _, _) -> ValueSome n | _ -> ValueNone

src/Compiler/Utilities/illib.fs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -741,18 +741,6 @@ module Span =
741741

742742
state
743743

744-
module ValueOptionInternal =
745-
746-
let inline ofOption x =
747-
match x with
748-
| Some x -> ValueSome x
749-
| None -> ValueNone
750-
751-
let inline bind ([<InlineIfLambda>] f) x =
752-
match x with
753-
| ValueSome x -> f x
754-
| ValueNone -> ValueNone
755-
756744
module String =
757745
let make (n: int) (c: char) : string = String(c, n)
758746

src/Compiler/Utilities/illib.fsi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ module internal ResizeArray =
263263
module internal Span =
264264
val inline exists: predicate: ('T -> bool) -> span: Span<'T> -> bool
265265

266-
module internal ValueOptionInternal =
267-
268-
val inline ofOption: x: 'a option -> 'a voption
269-
270-
val inline bind: f: ('a -> 'b voption) -> x: 'a voption -> 'b voption
271-
272266
module internal String =
273267

274268
val make: n: int -> c: char -> string

vsintegration/src/FSharp.Editor/Common/Extensions.fs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -327,19 +327,6 @@ module Option =
327327
else
328328
None
329329

330-
[<RequireQualifiedAccess>]
331-
module ValueOption =
332-
333-
let inline ofOption o =
334-
match o with
335-
| Some v -> ValueSome v
336-
| _ -> ValueNone
337-
338-
let inline toOption o =
339-
match o with
340-
| ValueSome v -> Some v
341-
| _ -> None
342-
343330
[<RequireQualifiedAccess>]
344331
module IEnumerator =
345332
let chooseV f (e: IEnumerator<'T>) =

vsintegration/tests/FSharp.Editor.Tests/CodeFixes/CodeFixTestFramework.fs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ type Mode =
3333
| WithSettings of CodeFixesOptions
3434

3535
module ValueOption =
36-
let inline toOption o =
37-
match o with
38-
| ValueSome v -> Some v
39-
| _ -> None
40-
41-
let inline ofOption o =
42-
match o with
43-
| Some v -> ValueSome v
44-
| _ -> ValueNone
45-
4636
let inline either f y o =
4737
match o with
4838
| ValueSome v -> f v

0 commit comments

Comments
 (0)