提交 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 = ...@@ -432,8 +432,10 @@ module List =
let existsSquared f xss = xss |> List.exists (fun xs -> xs |> List.exists (fun x -> f x)) 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))) let mapiFoldSquared f z xss = mapFoldSquared f z (xss |> mapiSquared (fun i j x -> (i,j,x)))
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] /// Because FSharp.Compiler.Service is a library that will target FSharp.Core 4.5.2 for the forseeable future,
module ValueOption = /// 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 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 bind f x = match x with ValueSome x -> f x | ValueNone -> ValueNone
let inline isSome x = match x with ValueSome _ -> true | ValueNone -> false let inline isSome x = match x with ValueSome _ -> true | ValueNone -> false
......
...@@ -3197,10 +3197,10 @@ type internal SR private() = ...@@ -3197,10 +3197,10 @@ type internal SR private() =
/// (Originally from ..\FSComp.txt:1044) /// (Originally from ..\FSComp.txt:1044)
static member tastInvalidAddressOfMutableAcrossAssemblyBoundary() = (1188, GetStringFunc("tastInvalidAddressOfMutableAcrossAssemblyBoundary",",,,") ) 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. /// 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",",,,") ) 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. /// 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",",,,") ) 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>' /// 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) /// (Originally from ..\FSComp.txt:1047)
......
...@@ -2,91 +2,177 @@ ...@@ -2,91 +2,177 @@
namespace Microsoft.FSharp.Core namespace Microsoft.FSharp.Core
open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Core.Operators
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Option = module Option =
[<CompiledName("GetValue")>] [<CompiledName("GetValue")>]
let get option = match option with None -> invalidArg "option" (SR.GetString(SR.optionValueWasNone)) | Some x -> x let get option = match option with None -> invalidArg "option" (SR.GetString(SR.optionValueWasNone)) | Some x -> x
[<CompiledName("IsSome")>] [<CompiledName("IsSome")>]
let inline isSome option = match option with None -> false | Some _ -> true let inline isSome option = match option with None -> false | Some _ -> true
[<CompiledName("IsNone")>] [<CompiledName("IsNone")>]
let inline isNone option = match option with None -> true | Some _ -> false let inline isNone option = match option with None -> true | Some _ -> false
[<CompiledName("DefaultValue")>] [<CompiledName("DefaultValue")>]
let defaultValue value option = match option with None -> value | Some v -> v let defaultValue value option = match option with None -> value | Some v -> v
[<CompiledName("DefaultWith")>] [<CompiledName("DefaultWith")>]
let defaultWith defThunk option = match option with None -> defThunk () | Some v -> v let defaultWith defThunk option = match option with None -> defThunk () | Some v -> v
[<CompiledName("OrElse")>] [<CompiledName("OrElse")>]
let orElse ifNone option = match option with None -> ifNone | Some _ -> option let orElse ifNone option = match option with None -> ifNone | Some _ -> option
[<CompiledName("OrElseWith")>] [<CompiledName("OrElseWith")>]
let orElseWith ifNoneThunk option = match option with None -> ifNoneThunk () | Some _ -> option let orElseWith ifNoneThunk option = match option with None -> ifNoneThunk () | Some _ -> option
[<CompiledName("Count")>] [<CompiledName("Count")>]
let count option = match option with None -> 0 | Some _ -> 1 let count option = match option with None -> 0 | Some _ -> 1
[<CompiledName("Fold")>] [<CompiledName("Fold")>]
let fold<'T,'State> folder (state:'State) (option: option<'T>) = match option with None -> state | Some x -> folder state x let fold<'T,'State> folder (state:'State) (option: option<'T>) = match option with None -> state | Some x -> folder state x
[<CompiledName("FoldBack")>] [<CompiledName("FoldBack")>]
let foldBack<'T,'State> folder (option: option<'T>) (state:'State) = match option with None -> state | Some x -> folder x state let foldBack<'T,'State> folder (option: option<'T>) (state:'State) = match option with None -> state | Some x -> folder x state
[<CompiledName("Exists")>] [<CompiledName("Exists")>]
let exists predicate option = match option with None -> false | Some x -> predicate x let exists predicate option = match option with None -> false | Some x -> predicate x
[<CompiledName("ForAll")>] [<CompiledName("ForAll")>]
let forall predicate option = match option with None -> true | Some x -> predicate x let forall predicate option = match option with None -> true | Some x -> predicate x
[<CompiledName("Contains")>] [<CompiledName("Contains")>]
let inline contains value option = match option with None -> false | Some v -> v = value let inline contains value option = match option with None -> false | Some v -> v = value
[<CompiledName("Iterate")>] [<CompiledName("Iterate")>]
let iter action option = match option with None -> () | Some x -> action x let iter action option = match option with None -> () | Some x -> action x
[<CompiledName("Map")>] [<CompiledName("Map")>]
let map mapping option = match option with None -> None | Some x -> Some (mapping x) let map mapping option = match option with None -> None | Some x -> Some (mapping x)
[<CompiledName("Map2")>] [<CompiledName("Map2")>]
let map2 mapping option1 option2 = let map2 mapping option1 option2 =
match option1, option2 with match option1, option2 with
| Some x, Some y -> Some (mapping x y) | Some x, Some y -> Some (mapping x y)
| _ -> None | _ -> None
[<CompiledName("Map3")>] [<CompiledName("Map3")>]
let map3 mapping option1 option2 option3 = let map3 mapping option1 option2 option3 =
match option1, option2, option3 with match option1, option2, option3 with
| Some x, Some y, Some z -> Some (mapping x y z) | Some x, Some y, Some z -> Some (mapping x y z)
| _ -> None | _ -> None
[<CompiledName("Bind")>] [<CompiledName("Bind")>]
let bind binder option = match option with None -> None | Some x -> binder x let bind binder option = match option with None -> None | Some x -> binder x
[<CompiledName("Flatten")>] [<CompiledName("Flatten")>]
let flatten option = match option with None -> None | Some x -> x let flatten option = match option with None -> None | Some x -> x
[<CompiledName("Filter")>] [<CompiledName("Filter")>]
let filter predicate option = match option with None -> None | Some x -> if predicate x then Some x else None let filter predicate option = match option with None -> None | Some x -> if predicate x then Some x else None
[<CompiledName("ToArray")>] [<CompiledName("ToArray")>]
let toArray option = match option with None -> [| |] | Some x -> [| x |] let toArray option = match option with None -> [| |] | Some x -> [| x |]
[<CompiledName("ToList")>] [<CompiledName("ToList")>]
let toList option = match option with None -> [ ] | Some x -> [ x ] let toList option = match option with None -> [ ] | Some x -> [ x ]
[<CompiledName("ToNullable")>] [<CompiledName("ToNullable")>]
let toNullable option = match option with None -> System.Nullable() | Some v -> System.Nullable(v) let toNullable option = match option with None -> System.Nullable() | Some v -> System.Nullable(v)
[<CompiledName("OfNullable")>] [<CompiledName("OfNullable")>]
let ofNullable (value:System.Nullable<'T>) = if value.HasValue then Some value.Value else None let ofNullable (value:System.Nullable<'T>) = if value.HasValue then Some value.Value else None
[<CompiledName("OfObj")>] [<CompiledName("OfObj")>]
let ofObj value = match value with null -> None | _ -> Some value let ofObj value = match value with null -> None | _ -> Some value
[<CompiledName("ToObj")>] [<CompiledName("ToObj")>]
let toObj value = match value with None -> null | Some x -> x 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
此差异已折叠。
...@@ -3054,12 +3054,29 @@ namespace Microsoft.FSharp.Core ...@@ -3054,12 +3054,29 @@ namespace Microsoft.FSharp.Core
[<StructuralEquality; StructuralComparison>] [<StructuralEquality; StructuralComparison>]
[<Struct>] [<Struct>]
[<CompiledName("FSharpValueOption`1")>] [<CompiledName("FSharpValueOption`1")>]
[<DebuggerDisplay("ValueSome({Value})")>]
type ValueOption<'T> = type ValueOption<'T> =
| ValueNone : 'T voption | ValueNone : 'T voption
| ValueSome : 'T -> 'T voption | ValueSome : 'T -> 'T voption
member x.Value = match x with ValueSome x -> x | ValueNone -> raise (new System.InvalidOperationException("ValueOption.Value")) 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> and 'T voption = ValueOption<'T>
......
...@@ -1866,6 +1866,20 @@ namespace Microsoft.FSharp.Core ...@@ -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> /// <summary>Get the value of a 'ValueSome' option. An InvalidOperationException is raised if the option is 'ValueNone'.</summary>
member Value : 'T 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> /// <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. /// <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 ...@@ -1100,7 +1100,7 @@ let AddEntityForProvidedType (amap: Import.ImportMap, modref: ModuleOrNamespaceR
let tycon = Construct.NewProvidedTycon(resolutionEnvironment, st, importProvidedType, isSuppressRelocate, m) let tycon = Construct.NewProvidedTycon(resolutionEnvironment, st, importProvidedType, isSuppressRelocate, m)
modref.ModuleOrNamespaceType.AddProvidedTypeEntity(tycon) modref.ModuleOrNamespaceType.AddProvidedTypeEntity(tycon)
let tcref = modref.NestedTyconRef tycon let tcref = modref.NestedTyconRef tycon
System.Diagnostics.Debug.Assert(ValueOption.isSome modref.TryDeref) System.Diagnostics.Debug.Assert(ValueOptionInternal.isSome modref.TryDeref)
tcref tcref
......
...@@ -3162,7 +3162,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) = ...@@ -3162,7 +3162,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
| None -> false | None -> false
| Some mbrTyconRef -> | Some mbrTyconRef ->
// Check we can deref system_MarshalByRefObject_tcref. When compiling against the Silverlight mscorlib we can't // 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 // Check if this is a subtype of MarshalByRefObject
assert (cenv.g.system_MarshalByRefObject_ty.IsSome) assert (cenv.g.system_MarshalByRefObject_ty.IsSome)
ExistsSameHeadTypeInHierarchy cenv.g cenv.amap vref.Range (generalizedTyconRef tcref) cenv.g.system_MarshalByRefObject_ty.Value ExistsSameHeadTypeInHierarchy cenv.g cenv.amap vref.Range (generalizedTyconRef tcref) cenv.g.system_MarshalByRefObject_ty.Value
......
...@@ -66,7 +66,7 @@ type QuotationGenerationScope = ...@@ -66,7 +66,7 @@ type QuotationGenerationScope =
static member ComputeQuotationFormat g = static member ComputeQuotationFormat g =
let deserializeExValRef = ValRefForIntrinsic g.deserialize_quoted_FSharp_40_plus_info 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 QuotationSerializationFormat.FSharp_40_Plus
else else
QuotationSerializationFormat.FSharp_20_Plus QuotationSerializationFormat.FSharp_20_Plus
......
...@@ -86,7 +86,7 @@ module Impl = ...@@ -86,7 +86,7 @@ module Impl =
let entityIsUnresolved(entity:EntityRef) = let entityIsUnresolved(entity:EntityRef) =
match entity with match entity with
| ERefNonLocal(NonLocalEntityRef(ccu, _)) -> | ERefNonLocal(NonLocalEntityRef(ccu, _)) ->
ccu.IsUnresolvedReference && ValueOption.isNone entity.TryDeref ccu.IsUnresolvedReference && ValueOptionInternal.isNone entity.TryDeref
| _ -> false | _ -> false
let checkEntityIsResolved(entity:EntityRef) = let checkEntityIsResolved(entity:EntityRef) =
...@@ -755,11 +755,12 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) = ...@@ -755,11 +755,12 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) =
) )
let isUnresolved() = let isUnresolved() =
entityIsUnresolved v.TyconRef || ValueOption.isNone v.TryUnionCase entityIsUnresolved v.TyconRef || ValueOptionInternal.isNone v.TryUnionCase
let checkIsResolved() = let checkIsResolved() =
checkEntityIsResolved v.TyconRef 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) invalidOp (sprintf "The union case '%s' could not be found in the target type" v.CaseName)
member __.IsUnresolved = member __.IsUnresolved =
...@@ -872,10 +873,10 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) = ...@@ -872,10 +873,10 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) =
let isUnresolved() = let isUnresolved() =
d.TryDeclaringTyconRef |> Option.exists entityIsUnresolved || d.TryDeclaringTyconRef |> Option.exists entityIsUnresolved ||
match d with match d with
| AnonField _ -> false | AnonField _ -> false
| RecdOrClass v -> ValueOption.isNone v.TryRecdField | RecdOrClass v -> ValueOptionInternal.isNone v.TryRecdField
| Union (v, _) -> ValueOption.isNone v.TryUnionCase | Union (v, _) -> ValueOptionInternal.isNone v.TryUnionCase
| ILField _ -> false | ILField _ -> false
let checkIsResolved() = let checkIsResolved() =
...@@ -883,10 +884,10 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) = ...@@ -883,10 +884,10 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) =
match d with match d with
| AnonField _ -> () | AnonField _ -> ()
| RecdOrClass v -> | 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) invalidOp (sprintf "The record field '%s' could not be found in the target type" v.FieldName)
| Union (v, _) -> | 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) invalidOp (sprintf "The union case '%s' could not be found in the target type" v.CaseName)
| ILField _ -> () | ILField _ -> ()
...@@ -1378,7 +1379,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) = ...@@ -1378,7 +1379,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
let isUnresolved() = let isUnresolved() =
match fsharpInfo() with match fsharpInfo() with
| None -> false | None -> false
| Some v -> ValueOption.isNone v.TryDeref | Some v -> ValueOptionInternal.isNone v.TryDeref
let checkIsResolved() = let checkIsResolved() =
if isUnresolved() then if isUnresolved() then
......
...@@ -1901,7 +1901,7 @@ and [<Sealed; StructuredFormatDisplay("{DebugText}")>] ...@@ -1901,7 +1901,7 @@ and [<Sealed; StructuredFormatDisplay("{DebugText}")>]
|> List.tryFind (fun v -> match key.TypeForLinkage with |> List.tryFind (fun v -> match key.TypeForLinkage with
| None -> true | None -> true
| Some keyTy -> ccu.MemberSignatureEquality(keyTy,v.Type)) | Some keyTy -> ccu.MemberSignatureEquality(keyTy,v.Type))
|> ValueOption.ofOption |> ValueOptionInternal.ofOption
/// Get a table of values indexed by logical name /// Get a table of values indexed by logical name
member mtyp.AllValsByLogicalName = member mtyp.AllValsByLogicalName =
...@@ -3263,7 +3263,7 @@ and ...@@ -3263,7 +3263,7 @@ and
ValueSome tcr.binding ValueSome tcr.binding
/// Is the destination assembly available? /// 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. /// 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 member x.CompiledRepresentation = x.Deref.CompiledRepresentation
...@@ -3814,7 +3814,7 @@ and ...@@ -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)) | 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 /// 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 /// Get the attributes associated with the union case
member x.Attribs = x.UnionCase.Attribs member x.Attribs = x.UnionCase.Attribs
...@@ -3873,7 +3873,7 @@ and ...@@ -3873,7 +3873,7 @@ and
| None -> error(InternalError(sprintf "field %s not found in type %s" id tcref.LogicalName, tcref.Range)) | None -> error(InternalError(sprintf "field %s not found in type %s" id tcref.LogicalName, tcref.Range))
/// Try to dereference the reference /// 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 /// Get the attributes associated with the compiled property of the record field
member x.PropertyAttribs = x.RecdField.PropertyAttribs member x.PropertyAttribs = x.RecdField.PropertyAttribs
......
...@@ -224,28 +224,224 @@ type ValueOptionTests() = ...@@ -224,28 +224,224 @@ type ValueOptionTests() =
[<Test>] [<Test>]
member this.ValueOptionBasics () = member this.ValueOptionBasics () =
Assert.AreEqual( (ValueNone: int voption), (ValueNone: int voption)) 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) >= (ValueNone: int voption)) Assert.True((ValueNone: int voption) >= (ValueNone: int voption))
Assert.True( (ValueNone: int voption) < (ValueSome 1: int voption)) Assert.True((ValueNone: int voption) < (ValueSome 1: int voption))
Assert.True( (ValueSome 0: 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.True((ValueSome 1: int voption) > (ValueSome 0: int voption))
Assert.False( (ValueSome 1: int voption) < (ValueNone : int voption)) Assert.False((ValueSome 1: int voption) < (ValueNone : int voption))
Assert.True( (ValueSome 1: int voption) <= (ValueSome 1: int voption)) Assert.True((ValueSome 1: int voption) <= (ValueSome 1: int voption))
Assert.AreEqual( compare (ValueSome 1) (ValueSome 1), 0) Assert.AreEqual(compare (ValueSome 1) (ValueSome 1), 0)
Assert.True( compare (ValueSome 0) (ValueSome 1) < 0) Assert.True(compare (ValueSome 0) (ValueSome 1) < 0)
Assert.True( compare (ValueNone: int voption) (ValueSome 1) < 0) Assert.True(compare (ValueNone: int voption) (ValueSome 1) < 0)
Assert.True( compare (ValueSome 1) (ValueNone : int voption) > 0) Assert.True(compare (ValueSome 1) (ValueNone : int voption) > 0)
Assert.AreEqual( ValueSome 1, ValueSome 1) Assert.AreEqual(ValueSome 1, ValueSome 1)
Assert.AreNotEqual( ValueSome 2, ValueSome 1) Assert.AreNotEqual(ValueSome 2, ValueSome 1)
Assert.AreEqual( ValueSome 2, ValueSome 2) Assert.AreEqual(ValueSome 2, ValueSome 2)
Assert.AreEqual( ValueSome (ValueSome 2), ValueSome (ValueSome 2)) Assert.AreEqual(ValueSome (ValueSome 2), ValueSome (ValueSome 2))
Assert.AreNotEqual( ValueSome (ValueSome 2), ValueSome (ValueSome 1)) Assert.AreNotEqual(ValueSome (ValueSome 2), ValueSome (ValueSome 1))
Assert.AreNotEqual( ValueSome (ValueSome 0), ValueSome ValueNone) Assert.AreNotEqual(ValueSome (ValueSome 0), ValueSome ValueNone)
Assert.AreEqual( ValueSome (ValueNone: int voption), ValueSome (ValueNone: int voption)) Assert.AreEqual(ValueSome (ValueNone: int voption), ValueSome (ValueNone: int voption))
Assert.AreEqual( (ValueSome (ValueNone: int voption)).Value, (ValueNone: int voption)) Assert.AreEqual((ValueSome (ValueNone: int voption)).Value, (ValueNone: int voption))
Assert.AreEqual( (ValueSome 1).Value, 1) Assert.AreEqual((ValueSome 1).Value, 1)
Assert.AreEqual( (ValueSome (1,2)).Value, (1,2)) Assert.AreEqual((ValueSome (1,2)).Value, (1,2))
Assert.AreEqual(defaultValueArg ValueNone 1, 1) Assert.AreEqual(defaultValueArg ValueNone 1, 1)
Assert.AreEqual(defaultValueArg (ValueSome 3) 1, 3) 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 ...@@ -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 Value
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value() 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: Boolean Equals(System.Object)
Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode()
Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]()
...@@ -2762,6 +2769,36 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C ...@@ -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: 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: 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.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 Equals(System.Object)
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object)
Microsoft.FSharp.Core.OptionalArgumentAttribute: Int32 GetHashCode() Microsoft.FSharp.Core.OptionalArgumentAttribute: Int32 GetHashCode()
......
...@@ -2272,6 +2272,13 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item ...@@ -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 Value
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item()
Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value() 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: Boolean Equals(System.Object)
Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode()
Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]()
...@@ -2870,6 +2877,36 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C ...@@ -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: 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: 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.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 Equals(System.Object)
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute()
Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object) 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.
先完成此消息的编辑!
想要评论请 注册