Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit496c70d

Browse files
forkiKevinRansom
authored andcommitted
Remove second internal ValueOption (dotnet#5717)
* Remove second internal ValueOption* Update FSharp.Core in FCS* Cleanup
1 parentacbca82 commit496c70d

File tree

6 files changed

+21
-27
lines changed

6 files changed

+21
-27
lines changed

‎src/absil/illib.fs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,18 +432,12 @@ module List =
432432
letexistsSquared f xss= xss|> List.exists(fun xs-> xs|> List.exists(fun x-> f x))
433433
letmapiFoldSquared f z xss= mapFoldSquared f z(xss|> mapiSquared(fun i j x->(i,j,x)))
434434

435-
[<Struct>]
436-
typeValueOption<'T>=
437-
| ValueSomeof'T
438-
| ValueNone
439-
memberx.IsSome=match xwith ValueSome_->true| ValueNone->false
440-
memberx.IsNone=match xwith ValueSome_->false| ValueNone->true
441-
memberx.Value=match xwith ValueSome r-> r| ValueNone-> failwith"ValueOption.Value: value is None"
442-
443435
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
444436
moduleValueOption=
445437
let inlineofOption x=match xwith Some x-> ValueSome x| None-> ValueNone
446438
let inlinebind f x=match xwith ValueSome x-> f x| ValueNone-> ValueNone
439+
let inlineisSome x=match xwith ValueSome_->true| ValueNone->false
440+
let inlineisNone x=match xwith ValueSome_->false| ValueNone->true
447441

448442
typeStringwith
449443
member inlinex.StartsWithOrdinal(value)=

‎src/fsharp/NameResolution.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ let AddEntityForProvidedType (amap: Import.ImportMap, modref: ModuleOrNamespaceR
10971097
lettycon= Construct.NewProvidedTycon(resolutionEnvironment, st, importProvidedType, isSuppressRelocate, m)
10981098
modref.ModuleOrNamespaceType.AddProvidedTypeEntity(tycon)
10991099
lettcref= modref.NestedTyconRef tycon
1100-
System.Diagnostics.Debug.Assert modref.TryDeref.IsSome
1100+
System.Diagnostics.Debug.Assert(ValueOption.isSome modref.TryDeref)
11011101
tcref
11021102

11031103

‎src/fsharp/Optimizer.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3090,7 +3090,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
30903090
| None->false
30913091
| Some mbrTyconRef->
30923092
// Check we can deref system_MarshalByRefObject_tcref. When compiling against the Silverlight mscorlib we can't
3093-
if mbrTyconRef.TryDeref.IsSomethen
3093+
ifValueOption.isSomembrTyconRef.TryDerefthen
30943094
// Check if this is a subtype of MarshalByRefObject
30953095
assert(cenv.g.system_MarshalByRefObject_ty.IsSome)
30963096
ExistsSameHeadTypeInHierarchy cenv.g cenv.amap vref.Range(generalizedTyconRef tcref) cenv.g.system_MarshalByRefObject_ty.Value

‎src/fsharp/QuotationTranslator.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type QuotationGenerationScope =
6666

6767
static memberComputeQuotationFormat g=
6868
letdeserializeExValRef= ValRefForIntrinsic g.deserialize_quoted_FSharp_40_plus_info
69-
if deserializeExValRef.TryDeref.IsSomethen
69+
ifValueOption.isSomedeserializeExValRef.TryDerefthen
7070
QuotationSerializationFormat.FSharp_40_Plus
7171
else
7272
QuotationSerializationFormat.FSharp_20_Plus

‎src/fsharp/symbols/Symbols.fs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module Impl =
8686
letentityIsUnresolved(entity:EntityRef)=
8787
match entitywith
8888
| ERefNonLocal(NonLocalEntityRef(ccu,_))->
89-
ccu.IsUnresolvedReference&& entity.TryDeref.IsNone
89+
ccu.IsUnresolvedReference&&ValueOption.isNoneentity.TryDeref
9090
|_->false
9191

9292
letcheckEntityIsResolved(entity:EntityRef)=
@@ -754,10 +754,10 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) =
754754

755755

756756
letisUnresolved()=
757-
entityIsUnresolved v.TyconRef|| v.TryUnionCase.IsNone
757+
entityIsUnresolved v.TyconRef||ValueOption.isNonev.TryUnionCase
758758
letcheckIsResolved()=
759759
checkEntityIsResolved v.TyconRef
760-
if v.TryUnionCase.IsNonethen
760+
ifValueOption.isNonev.TryUnionCasethen
761761
invalidOp(sprintf"The union case '%s' could not be found in the target type" v.CaseName)
762762

763763
member__.IsUnresolved=
@@ -854,18 +854,18 @@ and FSharpField(cenv: SymbolEnv, d: FSharpFieldData) =
854854
letisUnresolved()=
855855
entityIsUnresolved d.DeclaringTyconRef||
856856
match dwith
857-
| RecdOrClass v-> v.TryRecdField.IsNone
858-
| Union(v,_)-> v.TryUnionCase.IsNone
857+
| RecdOrClass v->ValueOption.isNone v.TryRecdField
858+
| Union(v,_)->ValueOption.isNonev.TryUnionCase
859859
| ILField_->false
860860

861861
letcheckIsResolved()=
862862
checkEntityIsResolved d.DeclaringTyconRef
863863
match dwith
864864
| RecdOrClass v->
865-
if v.TryRecdField.IsNonethen
865+
ifValueOption.isNonev.TryRecdFieldthen
866866
invalidOp(sprintf"The record field '%s' could not be found in the target type" v.FieldName)
867867
| Union(v,_)->
868-
if v.TryUnionCase.IsNonethen
868+
ifValueOption.isNonev.TryUnionCasethen
869869
invalidOp(sprintf"The union case '%s' could not be found in the target type" v.CaseName)
870870
| ILField_->()
871871

@@ -1331,7 +1331,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
13311331
letisUnresolved()=
13321332
match fsharpInfo()with
13331333
| None->false
1334-
| Some v-> v.TryDeref.IsNone
1334+
| Some v->ValueOption.isNonev.TryDeref
13351335

13361336
letcheckIsResolved()=
13371337
if isUnresolved()then

‎src/fsharp/tast.fs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,7 +3260,7 @@ and
32603260
ValueSome tcr.binding
32613261

32623262
/// Is the destination assembly available?
3263-
membertcr.CanDeref= tcr.TryDeref.IsSome
3263+
membertcr.CanDeref=ValueOption.isSometcr.TryDeref
32643264

32653265
/// Gets the data indicating the compiled representation of a type or module in terms of Abstract IL data structures.
32663266
memberx.CompiledRepresentation= x.Deref.CompiledRepresentation
@@ -3811,7 +3811,7 @@ and
38113811
| None-> error(InternalError(sprintf"union case%s not found in type%s" x.CaseName x.TyconRef.LogicalName, x.TyconRef.Range))
38123812

38133813
/// Try to dereference the reference
3814-
memberx.TryUnionCase=x.TyconRef.TryDeref|> ValueOption.bind(fun tcref-> tcref.GetUnionCaseByName x.CaseName|> ValueOption.ofOption)
3814+
memberx.TryUnionCase= x.TyconRef.TryDeref|> ValueOption.bind(fun tcref-> tcref.GetUnionCaseByName x.CaseName|> ValueOption.ofOption)
38153815

38163816
/// Get the attributes associated with the union case
38173817
memberx.Attribs= x.UnionCase.Attribs
@@ -5447,9 +5447,9 @@ let primEntityRefEq compilingFslib fslibCcu (x : EntityRef) (y : EntityRef) =
54475447
// The tcrefs may have forwarders. If they may possibly be equal then resolve them to get their canonical references
54485448
// and compare those using pointer equality.
54495449
(not(nonLocalRefDefinitelyNotEq x.nlr y.nlr)&&
5450-
letv1= x.TryDeref
5451-
letv2=y.TryDeref
5452-
v1.IsSome&& v2.IsSome&& v1.Value=== v2.Value))then
5450+
match x.TryDerefwith
5451+
| ValueSome v1->matchy.TryDerefwith ValueSome v2-> v1=== v2|_->false
5452+
|_->match y.TryDerefwith ValueNone->true|_->false))then
54535453
true
54545454
else
54555455
compilingFslib&& fslibEntityRefEq fslibCcu x y
@@ -5473,9 +5473,9 @@ let primValRefEq compilingFslib fslibCcu (x : ValRef) (y : ValRef) =
54735473
else
54745474
(// Use TryDeref to guard against the platforms/times when certain F# language features aren't available,
54755475
// e.g. CompactFramework doesn't have support for quotations.
5476-
letv1=x.TryDeref
5477-
letv2=y.TryDeref
5478-
v1.IsSome&& v2.IsSome&& v1.Value=== v2.Value)
5476+
matchx.TryDerefwith
5477+
| ValueSome v1->matchy.TryDerefwith ValueSome v2-> v1=== v2|_->false
5478+
|_->match y.TryDerefwith ValueNone->true|_->false)
54795479
||(if compilingFslibthen fslibValRefEq fslibCcu x yelsefalse)
54805480

54815481
//---------------------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp