提交 44c7e10c 编写于 作者: P Phillip Carter 提交者: Kevin Ransom (msft)

FS-1065 Value Option Parity (#5772)

* Initial FS-1065 implementation

* Undo removal of compilationrepresentation suffix and update surface area

* Whoopise, add the suffix to the impl file

* Update coreclr surface area

* Revert the FSComp changes that somehow got picked up

* newline

* Consume internal VOption module functions

* More internal voption module functions
上级 58a48e15
......@@ -432,8 +432,10 @@ module List =
let existsSquared f xss = xss |> List.exists (fun xs -> xs |> List.exists (fun x -> f x))
let mapiFoldSquared f z xss = mapFoldSquared f z (xss |> mapiSquared (fun i j x -> (i,j,x)))
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module ValueOption =
/// Because FSharp.Compiler.Service is a library that will target FSharp.Core 4.5.2 for the forseeable future,
/// we need to stick these functions in this module rather than using the module functions for ValueOption
/// that come after FSharp.Core 4.5.2.
module ValueOptionInternal =
let inline ofOption x = match x with Some x -> ValueSome x | None -> ValueNone
let inline bind f x = match x with ValueSome x -> f x | ValueNone -> ValueNone
let inline isSome x = match x with ValueSome _ -> true | ValueNone -> false
......
......@@ -3197,10 +3197,10 @@ type internal SR private() =
/// (Originally from ..\FSComp.txt:1044)
static member tastInvalidAddressOfMutableAcrossAssemblyBoundary() = (1188, GetStringFunc("tastInvalidAddressOfMutableAcrossAssemblyBoundary",",,,") )
/// Remove spaces between the type name and type parameter, e.g. \"type C<'T>\", not type \"C <'T>\". Type parameters must be placed directly adjacent to the type name.
/// (Originally from ..\FSComp.txt:1045)
/// (Originally from ..\FSComp.txt:1043)
static member parsNonAdjacentTypars() = (1189, GetStringFunc("parsNonAdjacentTypars",",,,") )
/// Remove spaces between the type name and type parameter, e.g. \"C<'T>\", not \"C <'T>\". Type parameters must be placed directly adjacent to the type name.
/// (Originally from ..\FSComp.txt:1046)
/// (Originally from ..\FSComp.txt:1044)
static member parsNonAdjacentTyargs() = (1190, GetStringFunc("parsNonAdjacentTyargs",",,,") )
/// The use of the type syntax 'int C' and 'C <int>' is not permitted here. Consider adjusting this type to be written in the form 'C<int>'
/// (Originally from ..\FSComp.txt:1047)
......
......@@ -2,10 +2,10 @@
namespace Microsoft.FSharp.Core
open Microsoft.FSharp.Core.Operators
open Microsoft.FSharp.Core.Operators
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Option =
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Option =
[<CompiledName("GetValue")>]
let get option = match option with None -> invalidArg "option" (SR.GetString(SR.optionValueWasNone)) | Some x -> x
......@@ -90,3 +90,89 @@ namespace Microsoft.FSharp.Core
[<CompiledName("ToObj")>]
let toObj value = match value with None -> null | Some x -> x
module ValueOption =
[<CompiledName("GetValue")>]
let get voption = match voption with ValueNone -> invalidArg "option" (SR.GetString(SR.optionValueWasNone)) | ValueSome x -> x
[<CompiledName("IsSome")>]
let inline isSome voption = match voption with ValueNone -> false | ValueSome _ -> true
[<CompiledName("IsNone")>]
let inline isNone voption = match voption with ValueNone -> true | ValueSome _ -> false
[<CompiledName("DefaultValue")>]
let defaultValue value voption = match voption with ValueNone -> value | ValueSome v -> v
[<CompiledName("DefaultWith")>]
let defaultWith defThunk voption = match voption with ValueNone -> defThunk () | ValueSome v -> v
[<CompiledName("OrElse")>]
let orElse ifNone voption = match voption with ValueNone -> ifNone | ValueSome _ -> voption
[<CompiledName("OrElseWith")>]
let orElseWith ifNoneThunk voption = match voption with ValueNone -> ifNoneThunk () | ValueSome _ -> voption
[<CompiledName("Count")>]
let count voption = match voption with ValueNone -> 0 | ValueSome _ -> 1
[<CompiledName("Fold")>]
let fold<'T,'State> folder (state:'State) (voption: voption<'T>) = match voption with ValueNone -> state | ValueSome x -> folder state x
[<CompiledName("FoldBack")>]
let foldBack<'T,'State> folder (voption: voption<'T>) (state:'State) = match voption with ValueNone -> state | ValueSome x -> folder x state
[<CompiledName("Exists")>]
let exists predicate voption = match voption with ValueNone -> false | ValueSome x -> predicate x
[<CompiledName("ForAll")>]
let forall predicate voption = match voption with ValueNone -> true | ValueSome x -> predicate x
[<CompiledName("Contains")>]
let inline contains value voption = match voption with ValueNone -> false | ValueSome v -> v = value
[<CompiledName("Iterate")>]
let iter action voption = match voption with ValueNone -> () | ValueSome x -> action x
[<CompiledName("Map")>]
let map mapping voption = match voption with ValueNone -> ValueNone | ValueSome x -> ValueSome (mapping x)
[<CompiledName("Map2")>]
let map2 mapping voption1 voption2 =
match voption1, voption2 with
| ValueSome x, ValueSome y -> ValueSome (mapping x y)
| _ -> ValueNone
[<CompiledName("Map3")>]
let map3 mapping voption1 voption2 voption3 =
match voption1, voption2, voption3 with
| ValueSome x, ValueSome y, ValueSome z -> ValueSome (mapping x y z)
| _ -> ValueNone
[<CompiledName("Bind")>]
let bind binder voption = match voption with ValueNone -> ValueNone | ValueSome x -> binder x
[<CompiledName("Flatten")>]
let flatten voption = match voption with ValueNone -> ValueNone | ValueSome x -> x
[<CompiledName("Filter")>]
let filter predicate voption = match voption with ValueNone -> ValueNone | ValueSome x -> if predicate x then ValueSome x else ValueNone
[<CompiledName("ToArray")>]
let toArray voption = match voption with ValueNone -> [| |] | ValueSome x -> [| x |]
[<CompiledName("ToList")>]
let toList voption = match voption with ValueNone -> [ ] | ValueSome x -> [ x ]
[<CompiledName("ToNullable")>]
let toNullable voption = match voption with ValueNone -> System.Nullable() | ValueSome v -> System.Nullable(v)
[<CompiledName("OfNullable")>]
let ofNullable (value:System.Nullable<'T>) = if value.HasValue then ValueSome value.Value else ValueNone
[<CompiledName("OfObj")>]
let ofObj value = match value with null -> ValueNone | _ -> ValueSome value
[<CompiledName("ToObj")>]
let toObj value = match value with ValueNone -> null | ValueSome x -> x
......@@ -2,15 +2,14 @@
namespace Microsoft.FSharp.Core
open System
open Microsoft.FSharp.Core
open Microsoft.FSharp.Collections
open Microsoft.FSharp.Core.Operators
open Microsoft.FSharp.Collections
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
/// <summary>Basic operations on options.</summary>
module Option =
open System
open Microsoft.FSharp.Core
open Microsoft.FSharp.Collections
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
/// <summary>Basic operations on options.</summary>
module Option =
/// <summary>Returns true if the option is not None.</summary>
/// <param name="option">The input option.</param>
/// <returns>True if the option is not None.</returns>
......@@ -198,3 +197,192 @@ namespace Microsoft.FSharp.Core
/// <returns>The result value, which is null if the input was None.</returns>
[<CompiledName("ToObj")>]
val toObj: value: 'T option -> 'T when 'T : null
/// <summary>Basic operations on value options.</summary>
module ValueOption =
/// <summary>Returns true if the value option is not ValueNone.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>True if the value option is not ValueNone.</returns>
[<CompiledName("IsSome")>]
val inline isSome: voption:'T voption -> bool
/// <summary>Returns true if the value option is ValueNone.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>True if the voption is ValueNone.</returns>
[<CompiledName("IsNone")>]
val inline isNone: voption:'T voption -> bool
/// <summary>Gets the value of the value option if the option is <c>ValueSome</c>, otherwise returns the specified default value.</summary>
/// <param name="value">The specified default value.</param>
/// <param name="voption">The input voption.</param>
/// <returns>The voption if the voption is ValueSome, else the default value.</returns>
/// <remarks>Identical to the built-in <see cref="defaultArg"/> operator, except with the arguments swapped.</remarks>
[<CompiledName("DefaultValue")>]
val defaultValue: value:'T -> voption:'T voption -> 'T
/// <summary>Gets the value of the voption if the voption is <c>ValueSome</c>, otherwise evaluates <paramref name="defThunk"/> and returns the result.</summary>
/// <param name="defThunk">A thunk that provides a default value when evaluated.</param>
/// <param name="voption">The input voption.</param>
/// <returns>The voption if the voption is ValueSome, else the result of evaluating <paramref name="defThunk"/>.</returns>
/// <remarks><paramref name="defThunk"/> is not evaluated unless <paramref name="voption"/> is <c>ValueNone</c>.</remarks>
[<CompiledName("DefaultWith")>]
val defaultWith: defThunk:(unit -> 'T) -> voption:'T voption -> 'T
/// <summary>Returns <paramref name="option"/> if it is <c>Some</c>, otherwise returns <paramref name="ifNone"/>.</summary>
/// <param name="ifNone">The value to use if <paramref name="option"/> is <c>None</c>.</param>
/// <param name="option">The input option.</param>
/// <returns>The option if the option is Some, else the alternate option.</returns>
[<CompiledName("OrElse")>]
val orElse: ifNone:'T voption -> voption:'T voption -> 'T voption
/// <summary>Returns <paramref name="voption"/> if it is <c>Some</c>, otherwise evaluates <paramref name="ifNoneThunk"/> and returns the result.</summary>
/// <param name="ifNoneThunk">A thunk that provides an alternate value option when evaluated.</param>
/// <param name="voption">The input value option.</param>
/// <returns>The voption if the voption is ValueSome, else the result of evaluating <paramref name="ifNoneThunk"/>.</returns>
/// <remarks><paramref name="ifNoneThunk"/> is not evaluated unless <paramref name="voption"/> is <c>ValueNone</c>.</remarks>
[<CompiledName("OrElseWith")>]
val orElseWith: ifNoneThunk:(unit -> 'T voption) -> voption:'T voption -> 'T voption
/// <summary>Gets the value associated with the option.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>The value within the option.</returns>
/// <exception href="System.ArgumentException">Thrown when the option is ValueNone.</exception>
[<CompiledName("GetValue")>]
val get: voption:'T voption -> 'T
/// <summary><c>count inp</c> evaluates to <c>match inp with ValueNone -> 0 | ValueSome _ -> 1</c>.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>A zero if the option is ValueNone, a one otherwise.</returns>
[<CompiledName("Count")>]
val count: voption:'T voption -> int
/// <summary><c>fold f s inp</c> evaluates to <c>match inp with ValueNone -> s | ValueSome x -> f s x</c>.</summary>
/// <param name="folder">A function to update the state data when given a value from a value option.</param>
/// <param name="state">The initial state.</param>
/// <param name="voption">The input value option.</param>
/// <returns>The original state if the option is ValueNone, otherwise it returns the updated state with the folder
/// and the voption value.</returns>
[<CompiledName("Fold")>]
val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> voption:'T voption -> 'State
/// <summary><c>fold f inp s</c> evaluates to <c>match inp with ValueNone -> s | ValueSome x -> f x s</c>.</summary>
/// <param name="folder">A function to update the state data when given a value from a value option.</param>
/// <param name="voption">The input value option.</param>
/// <param name="state">The initial state.</param>
/// <returns>The original state if the option is ValueNone, otherwise it returns the updated state with the folder
/// and the voption value.</returns>
[<CompiledName("FoldBack")>]
val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> voption:'T voption -> state:'State -> 'State
/// <summary><c>exists p inp</c> evaluates to <c>match inp with ValueNone -> false | ValueSome x -> p x</c>.</summary>
/// <param name="predicate">A function that evaluates to a boolean when given a value from the option type.</param>
/// <param name="voption">The input value option.</param>
/// <returns>False if the option is ValueNone, otherwise it returns the result of applying the predicate
/// to the option value.</returns>
[<CompiledName("Exists")>]
val exists: predicate:('T -> bool) -> voption:'T voption -> bool
/// <summary><c>forall p inp</c> evaluates to <c>match inp with ValueNone -> true | ValueSome x -> p x</c>.</summary>
/// <param name="predicate">A function that evaluates to a boolean when given a value from the value option type.</param>
/// <param name="voption">The input value option.</param>
/// <returns>True if the option is None, otherwise it returns the result of applying the predicate
/// to the option value.</returns>
[<CompiledName("ForAll")>]
val forall: predicate:('T -> bool) -> voption:'T voption -> bool
/// <summary>Evaluates to true if <paramref name="voption"/> is <c>ValueSome</c> and its value is equal to <paramref name="value"/>.</summary>
/// <param name="value">The value to test for equality.</param>
/// <param name="voption">The input value option.</param>
/// <returns>True if the option is <c>ValueSome</c> and contains a value equal to <paramref name="value"/>, otherwise false.</returns>
[<CompiledName("Contains")>]
val inline contains: value:'T -> voption:'T voption -> bool when 'T : equality
/// <summary><c>iter f inp</c> executes <c>match inp with ValueNone -> () | ValueSome x -> f x</c>.</summary>
/// <param name="action">A function to apply to the voption value.</param>
/// <param name="voption">The input value option.</param>
/// <returns>Unit if the option is ValueNone, otherwise it returns the result of applying the predicate
/// to the voption value.</returns>
[<CompiledName("Iterate")>]
val iter: action:('T -> unit) -> voption:'T voption -> unit
/// <summary><c>map f inp</c> evaluates to <c>match inp with ValueNone -> ValueNone | ValueSome x -> ValueSome (f x)</c>.</summary>
/// <param name="mapping">A function to apply to the voption value.</param>
/// <param name="voption">The input value option.</param>
/// <returns>A value option of the input value after applying the mapping function, or ValueNone if the input is ValueNone.</returns>
[<CompiledName("Map")>]
val map: mapping:('T -> 'U) -> voption:'T voption -> 'U voption
/// <summary><c>map f voption1 voption2</c> evaluates to <c>match voption1, voption2 with ValueSome x, ValueSome y -> ValueSome (f x y) | _ -> ValueNone</c>.</summary>
/// <param name="mapping">A function to apply to the voption values.</param>
/// <param name="voption1">The first value option.</param>
/// <param name="voption2">The second value option.</param>
/// <returns>A value option of the input values after applying the mapping function, or ValueNone if either input is ValueNone.</returns>
[<CompiledName("Map2")>]
val map2: mapping:('T1 -> 'T2 -> 'U) -> voption1: 'T1 voption -> voption2: 'T2 voption -> 'U voption
/// <summary><c>map f voption1 voption2 voption3</c> evaluates to <c>match voption1, voption2, voption3 with ValueSome x, ValueSome y, ValueSome z -> ValueSome (f x y z) | _ -> ValueNone</c>.</summary>
/// <param name="mapping">A function to apply to the value option values.</param>
/// <param name="voption1">The first value option.</param>
/// <param name="voption2">The second value option.</param>
/// <param name="voption3">The third value option.</param>
/// <returns>A value option of the input values after applying the mapping function, or ValueNone if any input is ValueNone.</returns>
[<CompiledName("Map3")>]
val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> 'T1 voption -> 'T2 voption -> 'T3 voption -> 'U voption
/// <summary><c>bind f inp</c> evaluates to <c>match inp with ValueNone -> ValueNone | ValueSome x -> f x</c></summary>
/// <param name="binder">A function that takes the value of type T from a value option and transforms it into
/// a value option containing a value of type U.</param>
/// <param name="voption">The input value option.</param>
/// <returns>An option of the output type of the binder.</returns>
[<CompiledName("Bind")>]
val bind: binder:('T -> 'U voption) -> voption:'T voption -> 'U voption
/// <summary><c>flatten inp</c> evaluates to <c>match inp with ValueNone -> ValueNone | ValueSome x -> x</c></summary>
/// <param name="voption">The input value option.</param>
/// <returns>A value option of the output type of the binder.</returns>
/// <remarks><c>flatten</c> is equivalent to <c>bind id</c>.</remarks>
[<CompiledName("Flatten")>]
val flatten: voption:'T voption voption -> 'T voption
/// <summary><c>filter f inp</c> evaluates to <c>match inp with ValueNone -> ValueNone | ValueSome x -> if f x then ValueSome x else ValueNone</c>.</summary>
/// <param name="predicate">A function that evaluates whether the value contained in the value option should remain, or be filtered out.</param>
/// <param name="voption">The input value option.</param>
/// <returns>The input if the predicate evaluates to true; otherwise, ValueNone.</returns>
[<CompiledName("Filter")>]
val filter: predicate:('T -> bool) -> voption:'T voption -> 'T voption
/// <summary>Convert the value option to an array of length 0 or 1.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>The result array.</returns>
[<CompiledName("ToArray")>]
val toArray: voption:'T voption -> 'T[]
/// <summary>Convert the value option to a list of length 0 or 1.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>The result list.</returns>
[<CompiledName("ToList")>]
val toList: voption:'T voption -> 'T list
/// <summary>Convert the value option to a Nullable value.</summary>
/// <param name="voption">The input value option.</param>
/// <returns>The result value.</returns>
[<CompiledName("ToNullable")>]
val toNullable: voption:'T voption -> Nullable<'T>
/// <summary>Convert a Nullable value to a value option.</summary>
/// <param name="value">The input nullable value.</param>
/// <returns>The result value option.</returns>
[<CompiledName("OfNullable")>]
val ofNullable: value:Nullable<'T> -> 'T voption
/// <summary>Convert a potentially null value to a value option.</summary>
/// <param name="value">The input value.</param>
/// <returns>The result value option.</returns>
[<CompiledName("OfObj")>]
val ofObj: value: 'T -> 'T voption when 'T : null
/// <summary>Convert an option to a potentially null value.</summary>
/// <param name="value">The input value.</param>
/// <returns>The result value, which is null if the input was ValueNone.</returns>
[<CompiledName("ToObj")>]
val toObj: value: 'T voption -> 'T when 'T : null
......@@ -3054,12 +3054,29 @@ namespace Microsoft.FSharp.Core
[<StructuralEquality; StructuralComparison>]
[<Struct>]
[<CompiledName("FSharpValueOption`1")>]
[<DebuggerDisplay("ValueSome({Value})")>]
type ValueOption<'T> =
| ValueNone : 'T voption
| ValueSome : 'T -> 'T voption
member x.Value = match x with ValueSome x -> x | ValueNone -> raise (new System.InvalidOperationException("ValueOption.Value"))
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
static member None : 'T voption = ValueNone
static member Some (value) : 'T voption = ValueSome(value)
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
member x.IsNone = match x with ValueNone -> true | _ -> false
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
member x.IsSome = match x with ValueSome _ -> true | _ -> false
static member op_Implicit (value) : 'T option = Some(value)
override x.ToString() =
// x is non-null, hence ValueSome
"ValueSome("^anyToStringShowingNull x.Value^")"
and 'T voption = ValueOption<'T>
......
......@@ -1866,6 +1866,20 @@ namespace Microsoft.FSharp.Core
/// <summary>Get the value of a 'ValueSome' option. An InvalidOperationException is raised if the option is 'ValueNone'.</summary>
member Value : 'T
/// <summary>Create a value option value that is a 'ValueNone' value.</summary>
static member None : 'T voption
/// <summary>Create a value option value that is a 'Some' value.</summary>
/// <param name="value">The input value</param>
/// <returns>A value option representing the value.</returns>
static member Some : value:'T -> 'T voption
/// <summary>Return 'true' if the value option is a 'ValueSome' value.</summary>
member IsSome : bool
/// <summary>Return 'true' if the value option is a 'ValueNone' value.</summary>
member IsNone : bool
/// <summary>The type of optional values, represented as structs.</summary>
///
/// <remarks>Use the constructors <c>ValueSome</c> and <c>ValueNone</c> to create values of this type.
......
......@@ -1100,7 +1100,7 @@ let AddEntityForProvidedType (amap: Import.ImportMap, modref: ModuleOrNamespaceR
let tycon = Construct.NewProvidedTycon(resolutionEnvironment, st, importProvidedType, isSuppressRelocate, m)
modref.ModuleOrNamespaceType.AddProvidedTypeEntity(tycon)
let tcref = modref.NestedTyconRef tycon
System.Diagnostics.Debug.Assert(ValueOption.isSome modref.TryDeref)
System.Diagnostics.Debug.Assert(ValueOptionInternal.isSome modref.TryDeref)
tcref
......
......@@ -3162,7 +3162,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
| None -> false
| Some mbrTyconRef ->
// Check we can deref system_MarshalByRefObject_tcref. When compiling against the Silverlight mscorlib we can't
if ValueOption.isSome mbrTyconRef.TryDeref then
if ValueOptionInternal.isSome mbrTyconRef.TryDeref then
// Check if this is a subtype of MarshalByRefObject
assert (cenv.g.system_MarshalByRefObject_ty.IsSome)
ExistsSameHeadTypeInHierarchy cenv.g cenv.amap vref.Range (generalizedTyconRef tcref) cenv.g.system_MarshalByRefObject_ty.Value
......
......@@ -66,7 +66,7 @@ type QuotationGenerationScope =
static member ComputeQuotationFormat g =
let deserializeExValRef = ValRefForIntrinsic g.deserialize_quoted_FSharp_40_plus_info
if ValueOption.isSome deserializeExValRef.TryDeref then
if ValueOptionInternal.isSome deserializeExValRef.TryDeref then
QuotationSerializationFormat.FSharp_40_Plus
else
QuotationSerializationFormat.FSharp_20_Plus
......
......@@ -86,7 +86,7 @@ module Impl =
let entityIsUnresolved(entity:EntityRef) =
match entity with
| ERefNonLocal(NonLocalEntityRef(ccu, _)) ->
ccu.IsUnresolvedReference && ValueOption.isNone entity.TryDeref
ccu.IsUnresolvedReference && ValueOptionInternal.isNone entity.TryDeref
| _ -> false
let checkEntityIsResolved(entity:EntityRef) =
......@@ -756,10 +756,11 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) =
let isUnresolved() =
entityIsUnresolved v.TyconRef || ValueOption.isNone v.TryUnionCase
entityIsUnresolved v.TyconRef || ValueOptionInternal.isNone v.TryUnionCase
let checkIsResolved() =
checkEntityIsResolved v.TyconRef
if ValueOption.isNone v.TryUnionCase then
if ValueOptionInternal.isNone v.TryUnionCase then
invalidOp (sprintf "The union case '%s' could not be found in the target type" v.CaseName)
member __.IsUnresolved =
......@@ -874,8 +875,8 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) =
d.TryDeclaringTyconRef |> Option.exists entityIsUnresolved ||
match d with
| AnonField _ -> false
| RecdOrClass v -> ValueOption.isNone v.TryRecdField
| Union (v, _) -> ValueOption.isNone v.TryUnionCase
| RecdOrClass v -> ValueOptionInternal.isNone v.TryRecdField
| Union (v, _) -> ValueOptionInternal.isNone v.TryUnionCase
| ILField _ -> false
let checkIsResolved() =
......@@ -883,10 +884,10 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) =
match d with
| AnonField _ -> ()
| RecdOrClass v ->
if ValueOption.isNone v.TryRecdField then
if ValueOptionInternal.isNone v.TryRecdField then
invalidOp (sprintf "The record field '%s' could not be found in the target type" v.FieldName)
| Union (v, _) ->
if ValueOption.isNone v.TryUnionCase then
if ValueOptionInternal.isNone v.TryUnionCase then
invalidOp (sprintf "The union case '%s' could not be found in the target type" v.CaseName)
| ILField _ -> ()
......@@ -1378,7 +1379,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
let isUnresolved() =
match fsharpInfo() with
| None -> false
| Some v -> ValueOption.isNone v.TryDeref
| Some v -> ValueOptionInternal.isNone v.TryDeref
let checkIsResolved() =
if isUnresolved() then
......
......@@ -1901,7 +1901,7 @@ and [<Sealed; StructuredFormatDisplay("{DebugText}")>]
|> List.tryFind (fun v -> match key.TypeForLinkage with
| None -> true
| Some keyTy -> ccu.MemberSignatureEquality(keyTy,v.Type))
|> ValueOption.ofOption
|> ValueOptionInternal.ofOption
/// Get a table of values indexed by logical name
member mtyp.AllValsByLogicalName =
......@@ -3263,7 +3263,7 @@ and
ValueSome tcr.binding
/// Is the destination assembly available?
member tcr.CanDeref = ValueOption.isSome tcr.TryDeref
member tcr.CanDeref = ValueOptionInternal.isSome tcr.TryDeref
/// Gets the data indicating the compiled representation of a type or module in terms of Abstract IL data structures.
member x.CompiledRepresentation = x.Deref.CompiledRepresentation
......@@ -3814,7 +3814,7 @@ and
| None -> error(InternalError(sprintf "union case %s not found in type %s" x.CaseName x.TyconRef.LogicalName, x.TyconRef.Range))
/// Try to dereference the reference
member x.TryUnionCase = x.TyconRef.TryDeref |> ValueOption.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOption.ofOption)
member x.TryUnionCase = x.TyconRef.TryDeref |> ValueOptionInternal.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOptionInternal.ofOption)
/// Get the attributes associated with the union case
member x.Attribs = x.UnionCase.Attribs
......@@ -3873,7 +3873,7 @@ and
| None -> error(InternalError(sprintf "field %s not found in type %s" id tcref.LogicalName, tcref.Range))
/// Try to dereference the reference
member x.TryRecdField = x.TyconRef.TryDeref |> ValueOption.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOption.ofOption)
member x.TryRecdField = x.TyconRef.TryDeref |> ValueOptionInternal.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOptionInternal.ofOption)
/// Get the attributes associated with the compiled property of the record field
member x.PropertyAttribs = x.RecdField.PropertyAttribs
......
......@@ -224,28 +224,224 @@ type ValueOptionTests() =
[<Test>]
member this.ValueOptionBasics () =
Assert.AreEqual( (ValueNone: int voption), (ValueNone: int voption))
Assert.True( (ValueNone: int voption) <= (ValueNone: int voption))
Assert.True( (ValueNone: int voption) >= (ValueNone: int voption))
Assert.True( (ValueNone: int voption) < (ValueSome 1: int voption))
Assert.True( (ValueSome 0: int voption) < (ValueSome 1: int voption))
Assert.True( (ValueSome 1: int voption) > (ValueSome 0: int voption))
Assert.False( (ValueSome 1: int voption) < (ValueNone : int voption))
Assert.True( (ValueSome 1: int voption) <= (ValueSome 1: int voption))
Assert.AreEqual( compare (ValueSome 1) (ValueSome 1), 0)
Assert.True( compare (ValueSome 0) (ValueSome 1) < 0)
Assert.True( compare (ValueNone: int voption) (ValueSome 1) < 0)
Assert.True( compare (ValueSome 1) (ValueNone : int voption) > 0)
Assert.AreEqual( ValueSome 1, ValueSome 1)
Assert.AreNotEqual( ValueSome 2, ValueSome 1)
Assert.AreEqual( ValueSome 2, ValueSome 2)
Assert.AreEqual( ValueSome (ValueSome 2), ValueSome (ValueSome 2))
Assert.AreNotEqual( ValueSome (ValueSome 2), ValueSome (ValueSome 1))
Assert.AreNotEqual( ValueSome (ValueSome 0), ValueSome ValueNone)
Assert.AreEqual( ValueSome (ValueNone: int voption), ValueSome (ValueNone: int voption))
Assert.AreEqual( (ValueSome (ValueNone: int voption)).Value, (ValueNone: int voption))
Assert.AreEqual( (ValueSome 1).Value, 1)
Assert.AreEqual( (ValueSome (1,2)).Value, (1,2))
Assert.AreEqual((ValueNone: int voption), (ValueNone: int voption))
Assert.True((ValueNone: int voption) <= (ValueNone: int voption))
Assert.True((ValueNone: int voption) >= (ValueNone: int voption))
Assert.True((ValueNone: int voption) < (ValueSome 1: int voption))
Assert.True((ValueSome 0: int voption) < (ValueSome 1: int voption))
Assert.True((ValueSome 1: int voption) > (ValueSome 0: int voption))
Assert.False((ValueSome 1: int voption) < (ValueNone : int voption))
Assert.True((ValueSome 1: int voption) <= (ValueSome 1: int voption))
Assert.AreEqual(compare (ValueSome 1) (ValueSome 1), 0)
Assert.True(compare (ValueSome 0) (ValueSome 1) < 0)
Assert.True(compare (ValueNone: int voption) (ValueSome 1) < 0)
Assert.True(compare (ValueSome 1) (ValueNone : int voption) > 0)
Assert.AreEqual(ValueSome 1, ValueSome 1)
Assert.AreNotEqual(ValueSome 2, ValueSome 1)
Assert.AreEqual(ValueSome 2, ValueSome 2)
Assert.AreEqual(ValueSome (ValueSome 2), ValueSome (ValueSome 2))
Assert.AreNotEqual(ValueSome (ValueSome 2), ValueSome (ValueSome 1))
Assert.AreNotEqual(ValueSome (ValueSome 0), ValueSome ValueNone)
Assert.AreEqual(ValueSome (ValueNone: int voption), ValueSome (ValueNone: int voption))
Assert.AreEqual((ValueSome (ValueNone: int voption)).Value, (ValueNone: int voption))
Assert.AreEqual((ValueSome 1).Value, 1)
Assert.AreEqual((ValueSome (1,2)).Value, (1,2))
Assert.AreEqual(defaultValueArg ValueNone 1, 1)
Assert.AreEqual(defaultValueArg (ValueSome 3) 1, 3)
[<Test>]
member this.Flatten () =
Assert.AreEqual(ValueOption.flatten ValueNone, ValueNone)
Assert.AreEqual(ValueOption.flatten (ValueSome ValueNone), ValueNone)
Assert.AreEqual(ValueOption.flatten (ValueSome <| ValueSome 1), ValueSome 1)
Assert.AreEqual(ValueOption.flatten (ValueSome <| ValueSome ""), ValueSome "")
[<Test>]
member this.FilterValueSomeIntegerWhenPredicateReturnsTrue () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter (fun _ -> true)
actual = ValueSome x
|> Assert.True
[0;1;-1;42] |> List.iter test
[<Test>]
member this.FilterValueSomeStringWhenPredicateReturnsTrue () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter (fun _ -> true)
actual = ValueSome x
|> Assert.True
[""; " "; "Foo"; "Bar"] |> List.iter test
[<Test>]
member this.FilterValueSomeIntegerWhenPredicateReturnsFalse () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter (fun _ -> false)
actual = ValueNone
|> Assert.True
[0; 1; -1; 1337] |> List.iter test
[<Test>]
member this.FilterValueSomeStringWhenPredicateReturnsFalse () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter (fun _ -> false)
actual= ValueNone
|> Assert.True
[""; " "; "Ploeh"; "Fnaah"] |> List.iter test
[<Test>]
member this.FilterValueNoneReturnsCorrectResult () =
let test x =
let actual = ValueNone |> ValueOption.filter (fun _ -> x)
actual = ValueNone
|> Assert.True
[false; true] |> List.iter test
[<Test>]
member this.FilterValueSomeIntegerWhenPredicateEqualsInput () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter ((=) x)
actual = ValueSome x
|> Assert.True
[0; 1; -1; -2001] |> List.iter test
[<Test>]
member this.FilterValueSomeStringWhenPredicateEqualsInput () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter ((=) x)
actual = ValueSome x
|> Assert.True
[""; " "; "Xyzz"; "Sgryt"] |> List.iter test
[<Test>]
member this.FilterValueSomeIntegerWhenPredicateDoesNotEqualsInput () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter ((<>) x)
actual = ValueNone
|> Assert.True
[0; 1; -1; 927] |> List.iter test
[<Test>]
member this.FilterValueSomeStringWhenPredicateDoesNotEqualsInput () =
let test x =
let actual = x |> ValueSome |> ValueOption.filter ((<>) x)
actual = ValueNone
|> Assert.True
[""; " "; "Baz Quux"; "Corge grault"] |> List.iter test
[<Test>]
member this.Contains() =
Assert.IsFalse(ValueOption.contains 1 ValueNone)
Assert.IsTrue(ValueOption.contains 1 (ValueSome 1))
Assert.IsFalse(ValueOption.contains "" ValueNone)
Assert.IsTrue(ValueOption.contains "" (ValueSome ""))
Assert.IsFalse(ValueOption.contains ValueNone ValueNone)
Assert.IsTrue(ValueOption.contains ValueNone (ValueSome ValueNone))
[<Test>]
member this.OfToNullable() =
Assert.IsTrue(ValueOption.ofNullable (System.Nullable<int>()) = ValueNone)
Assert.IsTrue(ValueOption.ofNullable (System.Nullable<int>(3)) = ValueSome 3)
Assert.IsTrue(ValueOption.toNullable (ValueNone : int voption) = System.Nullable<int>())
Assert.IsTrue(ValueOption.toNullable (ValueNone : System.DateTime voption) = System.Nullable())
Assert.IsTrue(ValueOption.toNullable (ValueSome 3) = System.Nullable(3))
[<Test>]
member this.OfToObj() =
Assert.IsTrue(ValueOption.toObj (ValueSome "3") = "3")
Assert.IsTrue(ValueOption.toObj (ValueSome "") = "")
Assert.IsTrue(ValueOption.toObj (ValueSome null) = null)
Assert.IsTrue(ValueOption.toObj ValueNone = null)
Assert.IsTrue(ValueOption.ofObj "3" = ValueSome "3")
Assert.IsTrue(ValueOption.ofObj "" = ValueSome "")
Assert.IsTrue(ValueOption.ofObj [| "" |] = ValueSome [| "" |])
Assert.IsTrue(ValueOption.ofObj (null : string array) = ValueNone)
Assert.IsTrue(ValueOption.ofObj<string> null = ValueNone)
Assert.IsTrue(ValueOption.ofObj<string[]> null = ValueNone)
Assert.IsTrue(ValueOption.ofObj<int[]> null = ValueNone)
[<Test>]
member this.DefaultValue() =
Assert.AreEqual(ValueOption.defaultValue 3 ValueNone, 3)
Assert.AreEqual(ValueOption.defaultValue 3 (ValueSome 42), 42)
Assert.AreEqual(ValueOption.defaultValue "" ValueNone, "")
Assert.AreEqual(ValueOption.defaultValue "" (ValueSome "x"), "x")
[<Test>]
member this.DefaultWith() =
Assert.AreEqual(ValueOption.defaultWith (fun () -> 3) ValueNone, 3)
Assert.AreEqual(ValueOption.defaultWith (fun () -> "") ValueNone, "")
Assert.AreEqual(ValueOption.defaultWith assertWasNotCalledThunk (ValueSome 42), 42)
Assert.AreEqual(ValueOption.defaultWith assertWasNotCalledThunk (ValueSome ""), "")
[<Test>]
member this.OrElse() =
Assert.AreEqual(ValueOption.orElse ValueNone ValueNone, ValueNone)
Assert.AreEqual(ValueOption.orElse (ValueSome 3) ValueNone, ValueSome 3)
Assert.AreEqual(ValueOption.orElse ValueNone (ValueSome 42), ValueSome 42)
Assert.AreEqual(ValueOption.orElse (ValueSome 3) (ValueSome 42), ValueSome 42)
Assert.AreEqual(ValueOption.orElse (ValueSome "") ValueNone, ValueSome "")
Assert.AreEqual(ValueOption.orElse ValueNone (ValueSome "x"), ValueSome "x")
Assert.AreEqual(ValueOption.orElse (ValueSome "") (ValueSome "x"), ValueSome "x")
[<Test>]
member this.OrElseWith() =
Assert.AreEqual(ValueOption.orElseWith (fun () -> ValueNone) ValueNone, ValueNone)
Assert.AreEqual(ValueOption.orElseWith (fun () -> ValueSome 3) ValueNone, ValueSome 3)
Assert.AreEqual(ValueOption.orElseWith (fun () -> ValueSome "") ValueNone, ValueSome "")
Assert.AreEqual(ValueOption.orElseWith assertWasNotCalledThunk (ValueSome 42), ValueSome 42)
Assert.AreEqual(ValueOption.orElseWith assertWasNotCalledThunk (ValueSome ""), ValueSome "")
[<Test>]
member this.Map2() =
Assert.True(ValueOption.map2 (-) ValueNone ValueNone = ValueNone)
Assert.True(ValueOption.map2 (-) (ValueSome 1) ValueNone = ValueNone)
Assert.True(ValueOption.map2 (-) ValueNone (ValueSome 2) = ValueNone)
Assert.True(ValueOption.map2 (-) (ValueSome 1) (ValueSome 2) = ValueSome -1)
Assert.True(ValueOption.map2 (+) ValueNone ValueNone = ValueNone)
Assert.True(ValueOption.map2 (+) (ValueSome "x") ValueNone = ValueNone)
Assert.True(ValueOption.map2 (+) (ValueSome "x") (ValueSome "y") = ValueSome "xy")
Assert.True(ValueOption.map2 (+) ValueNone (ValueSome "y") = ValueNone)
[<Test>]
member this.Map3() =
let add3 x y z = string x + string y + string z
Assert.True(ValueOption.map3 add3 ValueNone ValueNone ValueNone = ValueNone)
Assert.True(ValueOption.map3 add3 (ValueSome 1) ValueNone ValueNone = ValueNone)
Assert.True(ValueOption.map3 add3 ValueNone (ValueSome 2) ValueNone = ValueNone)
Assert.True(ValueOption.map3 add3 (ValueSome 1) (ValueSome 2) ValueNone = ValueNone)
Assert.True(ValueOption.map3 add3 ValueNone ValueNone (ValueSome 3) = ValueNone)
Assert.True(ValueOption.map3 add3 (ValueSome 1) ValueNone (ValueSome 3) = ValueNone)
Assert.True(ValueOption.map3 add3 ValueNone (ValueSome 2) (ValueSome 3) = ValueNone)
Assert.True(ValueOption.map3 add3 (ValueSome 1) (ValueSome 2) (ValueSome 3) = ValueSome "123")
let concat3 x y z = x + y + z
Assert.True(ValueOption.map3 concat3 ValueNone ValueNone ValueNone = ValueNone)
Assert.True(ValueOption.map3 concat3 (ValueSome "x") ValueNone ValueNone = ValueNone)
Assert.True(ValueOption.map3 concat3 ValueNone (ValueSome "y") ValueNone = ValueNone)
Assert.True(ValueOption.map3 concat3 (ValueSome "x") (ValueSome "y") ValueNone = ValueNone)
Assert.True(ValueOption.map3 concat3 ValueNone ValueNone (ValueSome "z") = ValueNone)
Assert.True(ValueOption.map3 concat3 (ValueSome "x") ValueNone (ValueSome "z") = ValueNone)
Assert.True(ValueOption.map3 concat3 ValueNone (ValueSome "y") (ValueSome "z") = ValueNone)
Assert.True(ValueOption.map3 concat3 (ValueSome "x") (ValueSome "y") (ValueSome "z") = ValueSome "xyz")
[<Test>]
member this.MapBindEquivalenceProperties () =
let fn x = x + 3
Assert.AreEqual(ValueOption.map fn ValueNone, ValueOption.bind (fn >> ValueSome) ValueNone)
Assert.AreEqual(ValueOption.map fn (ValueSome 5), ValueOption.bind (fn >> ValueSome) (ValueSome 5))
\ No newline at end of file
......@@ -2192,6 +2192,13 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T)
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None()
Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object)
Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode()
Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]()
......@@ -2762,6 +2769,36 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C
Microsoft.FSharp.Core.OptionModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpOption`1[T])
Microsoft.FSharp.Core.OptionModule: T[] ToArray[T](Microsoft.FSharp.Core.FSharpOption`1[T])
Microsoft.FSharp.Core.OptionModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object)
Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode()
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T)
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: System.String ToString()
Microsoft.FSharp.Core.ValueOption: System.Type GetType()
Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState)
Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Equals(System.Object)
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object)
Microsoft.FSharp.Core.OptionalArgumentAttribute: Int32 GetHashCode()
......
......@@ -2272,6 +2272,13 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T)
Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None()
Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object)
Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode()
Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]()
......@@ -2870,6 +2877,36 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C
Microsoft.FSharp.Core.OptionModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpOption`1[T])
Microsoft.FSharp.Core.OptionModule: T[] ToArray[T](Microsoft.FSharp.Core.FSharpOption`1[T])
Microsoft.FSharp.Core.OptionModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object)
Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode()
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T)
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: System.String ToString()
Microsoft.FSharp.Core.ValueOption: System.Type GetType()
Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState)
Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T])
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Equals(System.Object)
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute()
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册