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

Commit92948a2

Browse files
authored
remove asserts from properties on Val (dotnet#5032)
1 parent7d53b07 commit92948a2

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

‎src/fsharp/Optimizer.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,15 @@ type ValInfos(entries) =
134134
lazy(
135135
letdict= Dictionary<_,_>()
136136
for(vref,_x)as pin entriesdo
137-
dict.Add(vref.Deref.LinkagePartialKey, p)|> ignore
137+
letvkey= vref.Deref.GetLinkagePartialKey()
138+
dict.Add(vkey, p)|> ignore
138139
dict)
139140

140141
memberx.Entries= valInfoTable.Force().Values
141142
memberx.Map f= ValInfos(Seq.map f x.Entries)
142143
memberx.Filter f= ValInfos(Seq.filter f x.Entries)
143144
memberx.TryFind(v:ValRef)= valInfoTable.Force().TryFind v.Deref
144-
memberx.TryFindForFslib(v:ValRef)= valInfosForFslib.Force().TryGetValue(v.Deref.LinkagePartialKey)
145+
memberx.TryFindForFslib(v:ValRef)= valInfosForFslib.Force().TryGetValue(v.Deref.GetLinkagePartialKey())
145146

146147
typeModuleInfo=
147148
{ ValInfos:ValInfos

‎src/fsharp/SignatureConformance.fs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,11 @@ type Checker(g, amap, denv, remapInfo: SignatureRepackageInfo, checkingSig) =
551551
Printf.bprintf os"%s" fx.DisplayName),m))
552552

553553
letvaluesPartiallyMatch(av:Val)(fv:Val)=
554-
(av.LinkagePartialKey.MemberParentMangledName= fv.LinkagePartialKey.MemberParentMangledName)&&
555-
(av.LinkagePartialKey.LogicalName= fv.LinkagePartialKey.LogicalName)&&
556-
(av.LinkagePartialKey.TotalArgCount= fv.LinkagePartialKey.TotalArgCount)
554+
letakey= av.GetLinkagePartialKey()
555+
letfkey= fv.GetLinkagePartialKey()
556+
(akey.MemberParentMangledName= fkey.MemberParentMangledName)&&
557+
(akey.LogicalName= fkey.LogicalName)&&
558+
(akey.TotalArgCount= fkey.TotalArgCount)
557559

558560
(implModType.AllValsAndMembersByLogicalNameUncached, signModType.AllValsAndMembersByLogicalNameUncached)
559561
||> NameMap.suball2

‎src/fsharp/TastOps.fs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3809,13 +3809,14 @@ let accSubEntityRemap (msigty:ModuleOrNamespaceType) (entity:Entity) (mrpi, mhi)
38093809
(mrpi, mhi)
38103810

38113811
letvalLinkageAEquiv g aenv(v1:Val)(v2:Val)=
3812-
(v1.LinkagePartialKey= v2.LinkagePartialKey)&&
3812+
(v1.GetLinkagePartialKey()= v2.GetLinkagePartialKey())&&
38133813
(if v1.IsMember&& v2.IsMemberthen typeAEquivAux EraseAll g aenv v1.Type v2.Typeelsetrue)
38143814

38153815
letaccValRemap g aenv(msigty:ModuleOrNamespaceType)(implVal:Val)(mrpi,mhi)=
3816+
letimplValKey= implVal.GetLinkagePartialKey()
38163817
letsigValOpt=
38173818
msigty.AllValsAndMembersByPartialLinkageKey
3818-
|> MultiMap.findimplVal.LinkagePartialKey
3819+
|> MultiMap.findimplValKey
38193820
|> List.tryFind(fun sigVal-> valLinkageAEquiv g aenv implVal sigVal)
38203821

38213822
letvref= mkLocalValRef implVal

‎src/fsharp/tast.fs‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -979,14 +979,14 @@ and /// Represents a type definition, exception definition, module definition or
979979
memberx.FSharpObjectModelTypeInfo=
980980
match x.TypeReprInfowith
981981
| TFSharpObjectRepr x-> x
982-
|_->assertfalse;failwith"not an F# object model type definition"
982+
|_-> failwith"not an F# object model type definition"
983983

984984
/// Indicate if this is a type definition backed by Abstract IL metadata.
985985
memberx.IsILTycon=match x.TypeReprInfowith| TILObjectRepr_->true|_->false
986986

987987
/// Get the Abstract IL scope, nesting and metadata for this
988988
/// type definition, assuming it is backed by Abstract IL metadata.
989-
memberx.ILTyconInfo=match x.TypeReprInfowith| TILObjectRepr data-> data|_->assertfalse;failwith"not a .NET type definition"
989+
memberx.ILTyconInfo=match x.TypeReprInfowith| TILObjectRepr data-> data|_-> failwith"not a .NET type definition"
990990

991991
/// Get the Abstract IL metadata for this type definition, assuming it is backed by Abstract IL metadata.
992992
memberx.ILTyconRawMetadata=let(TILObjectReprData(_,_,td))= x.ILTyconInfoin td
@@ -1386,7 +1386,7 @@ and
13861386

13871387
memberinfo.BaseTypeForErased(m,objTy)=
13881388
if info.IsErasedthen info.LazyBaseType.Force(m,objTy)
1389-
elseassertfalse;failwith"expect erased type"
1389+
else failwith"expect erased type"
13901390

13911391
overridex.ToString()="TProvidedTypeInfo(...)"
13921392

@@ -1784,7 +1784,8 @@ and [<Sealed>] ModuleOrNamespaceType(kind: ModuleOrNamespaceKind, vals: QueueLis
17841784
membermtyp.AllValsAndMembersByPartialLinkageKey=
17851785
letaddValByMangledName(x:Val)tab=
17861786
if x.IsCompiledAsTopLevelthen
1787-
MultiMap.add x.LinkagePartialKey x tab
1787+
letkey= x.GetLinkagePartialKey()
1788+
MultiMap.add key x tab
17881789
else
17891790
tab
17901791
cacheOptRef allValsAndMembersByPartialLinkageKeyCache(fun()->
@@ -2458,18 +2459,18 @@ and [<StructuredFormatDisplay("{LogicalName}")>]
24582459
memberx.IsCompiledAsTopLevel= x.ValReprInfo.IsSome
24592460

24602461
/// The partial information used to index the methods of all those in a ModuleOrNamespace.
2461-
memberx.LinkagePartialKey:ValLinkagePartialKey=
2462+
memberx.GetLinkagePartialKey():ValLinkagePartialKey=
24622463
assert x.IsCompiledAsTopLevel
24632464
{ LogicalName= x.LogicalName
24642465
MemberParentMangledName=(if x.IsMemberthen Some x.MemberApparentEntity.LogicalNameelse None)
24652466
MemberIsOverride= x.IsOverrideOrExplicitImpl
24662467
TotalArgCount=if x.IsMemberthen x.ValReprInfo.Value.TotalArgCountelse0}
24672468

24682469
/// The full information used to identify a specific overloaded method amongst all those in a ModuleOrNamespace.
2469-
memberx.LinkageFullKey:ValLinkageFullKey=
2470+
memberx.GetLinkageFullKey():ValLinkageFullKey=
24702471
assert x.IsCompiledAsTopLevel
2471-
ValLinkageFullKey(x.LinkagePartialKey,(if x.IsMemberthen Some x.Typeelse None))
2472-
2472+
letkey= x.GetLinkagePartialKey()
2473+
ValLinkageFullKey(key,(if x.IsMemberthen Some x.Typeelse None))
24732474

24742475
/// Is this a member definition or module definition?
24752476
memberx.IsMemberOrModuleBinding= x.val_flags.IsMemberOrModuleBinding
@@ -2653,7 +2654,7 @@ and [<StructuredFormatDisplay("{LogicalName}")>]
26532654
| Parent eref->
26542655
match eref.PublicPathwith
26552656
| None-> None
2656-
| Some p-> Some(ValPubPath(p,x.LinkageFullKey))
2657+
| Some p-> Some(ValPubPath(p,x.GetLinkageFullKey()))
26572658
| ParentNone->
26582659
None
26592660

@@ -4986,7 +4987,9 @@ let mkNonLocalCcuRootEntityRef ccu (x:Entity) = mkNonLocalTyconRefPreResolved x
49864987
letmkNestedValRef(cref:EntityRef)(v:Val):ValRef=
49874988
match crefwith
49884989
| ERefLocal_-> mkLocalValRef v
4989-
| ERefNonLocal nlr-> mkNonLocalValRefPreResolved v nlr v.LinkageFullKey
4990+
| ERefNonLocal nlr->
4991+
letkey= v.GetLinkageFullKey()
4992+
mkNonLocalValRefPreResolved v nlr key
49904993

49914994
/// From Ref_private to Ref_nonlocal when exporting data.
49924995
letrescopePubPathToParent viewedCcu(PubPath(p))= NonLocalEntityRef(viewedCcu, p.[0..p.Length-2])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp