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

Commit506c338

Browse files
authored
Merge pull requestdotnet#4767 from Microsoft/merges/master-to-dev15.8
Merge master to dev15.8
2 parents2544d91 +74710b9 commit506c338

File tree

62 files changed

+554
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+554
-257
lines changed

‎src/absil/il.fs‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,13 @@ type LazyOrderedMultiMap<'Key,'Data when 'Key : equality>(keyf : 'Data -> 'Key,
173173
letquickMap=
174174
lazyItems|> lazyMap(fun entries->
175175
lett=new Dictionary<_,_>(entries.Length, HashIdentity.Structural)
176-
do entries|> List.iter(fun y->letkey= keyf yin t.[key]<- y::(if t.ContainsKey(key)then t.[key]else[]))
176+
do entries|> List.iter(fun y->
177+
letkey= keyf y
178+
letv=
179+
match t.TryGetValue(key)with
180+
|true, v-> v
181+
|_->[]
182+
t.[key]<- y:: v)
177183
t)
178184

179185
memberself.Entries()= lazyItems.Force()
@@ -182,7 +188,11 @@ type LazyOrderedMultiMap<'Key,'Data when 'Key : equality>(keyf : 'Data -> 'Key,
182188

183189
memberself.Filter(f)=new LazyOrderedMultiMap<'Key,'Data>(keyf, lazyItems|> lazyMap(List.filter f))
184190

185-
memberself.Itemwith get(x)=lett= quickMap.Force()inif t.ContainsKey xthen t.[x]else[]
191+
memberself.Item
192+
with get(x)=
193+
match quickMap.Force().TryGetValue(x)with
194+
|true, v-> v
195+
|_->[]
186196

187197

188198
//---------------------------------------------------------------------
@@ -1535,10 +1545,9 @@ type ILMethodDefs(f : (unit -> ILMethodDef[])) =
15351545
for i= arr.Length-1downto0do
15361546
lety= arr.[i]
15371547
letkey= y.Name
1538-
if t.ContainsKey keythen
1539-
t.[key]<- y:: t.[key]
1540-
else
1541-
t.[key]<-[ y]
1548+
match t.TryGetValue(key)with
1549+
|true, m-> t.[key]<- y:: m
1550+
|_-> t.[key]<-[y]
15421551
t)
15431552

15441553
interface IEnumerablewith
@@ -1549,7 +1558,12 @@ type ILMethodDefs(f : (unit -> ILMethodDef[])) =
15491558

15501559
memberx.AsArray= array.Value
15511560
memberx.AsList= array.Value|> Array.toList
1552-
memberx.FindByName nm=if dict.Value.ContainsKey nmthen dict.Value.[nm]else[]
1561+
1562+
memberx.FindByName(nm)=
1563+
match dict.Value.TryGetValue(nm)with
1564+
|true, m-> m
1565+
|_->[]
1566+
15531567
memberx.FindByNameAndArity(nm,arity)= x.FindByName nm|> List.filter(fun x-> List.length x.Parameters= arity)
15541568

15551569
[<NoComparison; NoEquality>]

‎src/absil/illib.fs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,10 @@ let _ = eventually { use x = null in return 1 }
907907
typeUniqueStampGenerator<'Twhen'T:equality>()=
908908
letencodeTab=new Dictionary<'T,int>(HashIdentity.Structural)
909909
let mutablenItems=0
910-
letencode str=
911-
if encodeTab.ContainsKey(str)
912-
then
913-
encodeTab.[str]
914-
else
910+
letencode str=
911+
match encodeTab.TryGetValue(str)with
912+
|true, idx-> idx
913+
|_->
915914
letidx= nItems
916915
encodeTab.[str]<- idx
917916
nItems<- nItems+1

‎src/absil/ilread.fs‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,14 @@ let mkCacheGeneric lowMem _inbase _nm _sz =
925925
|null-> cache:=new Dictionary<_,_>(11(* sz:int*))
926926
|_->()
927927
!cache
928-
if cache.ContainsKey idxthen(incr count; cache.[idx])
929-
elseletres= f idxin cache.[idx]<- res; res
928+
match cache.TryGetValue(idx)with
929+
|true, v->
930+
incr count
931+
v
932+
|_->
933+
letres= f idx
934+
cache.[idx]<- res
935+
res
930936

931937
//-----------------------------------------------------------------------
932938
// Polymorphic general helpers for searching for particular rows.
@@ -2652,11 +2658,10 @@ and seekReadImplMap (ctxt: ILMetadataReader) nm midx =
26522658
andseekReadTopCode(ctxt:ILMetadataReader)pev mdv numtypars(sz:int)start seqpoints=
26532659
letlabelsOfRawOffsets=new Dictionary<_,_>(sz/2)
26542660
letilOffsetsOfLabels=new Dictionary<_,_>(sz/2)
2655-
lettryRawToLabel rawOffset=
2656-
if labelsOfRawOffsets.ContainsKey rawOffsetthen
2657-
Some(labelsOfRawOffsets.[rawOffset])
2658-
else
2659-
None
2661+
lettryRawToLabel rawOffset=
2662+
match labelsOfRawOffsets.TryGetValue(rawOffset)with
2663+
|true, v-> Some v
2664+
|_-> None
26602665

26612666
letrawToLabel rawOffset=
26622667
match tryRawToLabel rawOffsetwith
@@ -3092,11 +3097,9 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int
30923097
end
30933098

30943099
letkey=(tryStart, tryFinish)
3095-
if sehMap.ContainsKey keythen
3096-
letprev= sehMap.[key]
3097-
sehMap.[key]<-(prev@[clause])
3098-
else
3099-
sehMap.[key]<-[clause])
3100+
match sehMap.TryGetValue(key)with
3101+
|true, prev-> sehMap.[key]<- prev@[clause]
3102+
|_-> sehMap.[key]<-[clause])
31003103
clauses
31013104
([], sehMap)||> Seq.fold(fun acc(KeyValue(key,bs))->[for bin bs->{Range=key; Clause=b}: ILExceptionSpec]@ acc)
31023105
seh:= sehClauses
@@ -3295,7 +3298,10 @@ let getPdbReader pdbPath fileName =
32953298
documentType= Some(pdbDocumentGetType pdbdoc),
32963299
file= url))
32973300

3298-
letdocfun url=if tab.ContainsKey urlthen tab.[url]else failwith("Document with URL"+url+" not found in list of documents in the PDB file")
3301+
letdocfun url=
3302+
match tab.TryGetValue(url)with
3303+
|true, doc-> doc
3304+
|_-> failwith("Document with URL"+ url+" not found in list of documents in the PDB file")
32993305
Some(pdbr, docfun)
33003306
with e-> dprintn("* Warning: PDB file could not be read and will be ignored:"+e.Message); None
33013307
#endif

‎src/absil/ilreflect.fs‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,15 +1317,21 @@ let emitCode cenv modB emEnv (ilG:ILGenerator) (code: ILCode) =
13171317
letemEnv=
13181318
(emEnv, code.Labels)||> Seq.fold(fun emEnv(KeyValue(label,pc))->
13191319
letlab= ilG.DefineLabelAndLog()
1320-
pc2lab.[pc]<-(if pc2lab.ContainsKey pcthen lab:: pc2lab.[pc]else[lab])
1320+
pc2lab.[pc]<-
1321+
match pc2lab.TryGetValue(pc)with
1322+
|true, labels-> lab:: labels
1323+
|_->[lab]
13211324
envSetLabel emEnv label lab)
13221325

13231326
// Build a table that contains the operations that define where exception handlers are
13241327
letpc2action= Dictionary()
13251328
letlab2pc= code.Labels
13261329
letadd lab action=
13271330
letpc= lab2pc.[lab]
1328-
pc2action.[pc]<-(if pc2action.ContainsKey pcthen pc2action.[pc]@[ action]else[ action])
1331+
pc2action.[pc]<-
1332+
match pc2action.TryGetValue(pc)with
1333+
|true, actions-> actions@[action]
1334+
|_->[action]
13291335

13301336
for ein code.Exceptionsdo
13311337
let(startTry,_endTry)= e.Range
@@ -1354,12 +1360,18 @@ let emitCode cenv modB emEnv (ilG:ILGenerator) (code: ILCode) =
13541360
letinstrs= code.Instrs
13551361

13561362
for pc=0to instrs.Lengthdo
1357-
if pc2action.ContainsKey pcthen
1358-
for actionin pc2action.[pc]do
1363+
match pc2action.TryGetValue(pc)with
1364+
|true, actions->
1365+
for actionin actionsdo
13591366
action()
1360-
if pc2lab.ContainsKey pcthen
1361-
for labin pc2lab.[pc]do
1362-
ilG.MarkLabelAndLog lab
1367+
|_->()
1368+
1369+
match pc2lab.TryGetValue(pc)with
1370+
|true, labels->
1371+
for labin labelsdo
1372+
ilG.MarkLabelAndLog(lab)
1373+
|_->()
1374+
13631375
if pc< instrs.Lengththen
13641376
match instrs.[pc]with
13651377
| I_br lwhen code.Labels.[l]= pc+1->()// compress I_br to next instruction

‎src/absil/ilwrite.fs‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,9 +1643,10 @@ module Codebuf =
16431643
// a safe approximation because code only gets smaller.
16441644
ifnot(origAvailBrFixups.ContainsKey tg)then
16451645
dprintn("branch target"+ formatCodeLabel tg+" not found in code")
1646-
letorigDest=
1647-
if origAvailBrFixups.ContainsKey tgthen origAvailBrFixups.[tg]
1648-
else666666
1646+
letorigDest=
1647+
match origAvailBrFixups.TryGetValue(tg)with
1648+
|true, fixup-> fixup
1649+
|_->666666
16491650
letorigRelOffset= origDest- origEndOfInstr
16501651
-128<= origRelOffset&& origRelOffset<=127
16511652
end
@@ -1718,18 +1719,16 @@ module Codebuf =
17181719

17191720
// Now apply the adjusted fixups in the new code
17201721
newReqdBrFixups|> List.iter(fun(newFixupLoc,endOfInstr,tg,small)->
1721-
ifnot(newAvailBrFixups.ContainsKey tg)then
1722-
failwith("target"+formatCodeLabel tg+" not found in new fixups")
1723-
try
1724-
letn= newAvailBrFixups.[tg]
1725-
letrelOffset=(n- endOfInstr)
1726-
if smallthen
1727-
if Bytes.get newCode newFixupLoc<>0x98then failwith"br fixupsanity check failed"
1728-
newCode.[newFixupLoc]<- b0 relOffset
1729-
else
1730-
checkFixup32 newCode newFixupLoc0xf00dd00fl
1731-
applyFixup32 newCode newFixupLoc relOffset
1732-
with:? KeyNotFoundException->())
1722+
match newAvailBrFixups.TryGetValue(tg)with
1723+
|true, n->
1724+
letrelOffset= n- endOfInstr
1725+
if smallthen
1726+
if Bytes.get newCode newFixupLoc<>0x98then failwith"br fixupsanity check failed"
1727+
newCode.[newFixupLoc]<- b0 relOffset
1728+
else
1729+
checkFixup32 newCode newFixupLoc0xf00dd00fl
1730+
applyFixup32 newCode newFixupLoc relOffset
1731+
|_-> failwith("target"+ formatCodeLabel tg+" not found in new fixups"))
17331732

17341733
newCode, newReqdStringFixups, newExnClauses, newSeqPoints, newScopes
17351734

@@ -2162,14 +2161,19 @@ module Codebuf =
21622161
// Build a table mapping Abstract IL pcs to positions in the generated code buffer
21632162
letpc2pos= Array.zeroCreate(instrs.Length+1)
21642163
letpc2labs= Dictionary()
2165-
for(KeyValue(lab, pc))in code.Labelsdo
2166-
if pc2labs.ContainsKey pcthen pc2labs.[pc]<- lab:: pc2labs.[pc]else pc2labs.[pc]<-[lab]
2164+
for KeyValue(lab, pc)in code.Labelsdo
2165+
match pc2labs.TryGetValue(pc)with
2166+
|true, labels->
2167+
pc2labs.[pc]<- lab:: labels
2168+
|_-> pc2labs.[pc]<-[lab]
21672169

21682170
// Emit the instructions
21692171
for pc=0to instrs.Lengthdo
2170-
if pc2labs.ContainsKey pcthen
2171-
for labin pc2labs.[pc]do
2172-
codebuf.RecordAvailBrFixup lab
2172+
match pc2labs.TryGetValue(pc)with
2173+
|true, labels->
2174+
for labin labelsdo
2175+
codebuf.RecordAvailBrFixup(lab)
2176+
|_->()
21732177
pc2pos.[pc]<- codebuf.code.Position
21742178
if pc< instrs.Lengththen
21752179
match instrs.[pc]with

‎src/buildfromsource/FSharp.Compiler.Private/FSComp.resx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3379,7 +3379,7 @@
33793379
<value>No implementation files specified</value>
33803380
</data>
33813381
<dataname="fscBadAssemblyVersion"xml:space="preserve">
3382-
<value>An {0} specified version '{1}', but this value is invalid and has been ignored</value>
3382+
<value>The attribute {0} specified version '{1}', but this value is invalid and has been ignored</value>
33833383
</data>
33843384
<dataname="fscTwoResourceManifests"xml:space="preserve">
33853385
<value>Conflicting options specified: 'win32manifest' and 'win32res'. Only one of these can be used.</value>

‎src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -641,24 +641,4 @@
641641
<PackageReferenceInclude="System.ValueTuple"Version="$(SystemValueTuplePackageVersion)" />
642642
</ItemGroup>
643643

644-
<ItemGroup>
645-
<PackageReferenceInclude="System.Collections.Immutable"Version="$(SystemCollectionsImmutablePackageVersion)" />
646-
<PackageReferenceInclude="System.Diagnostics.Process"Version="$(SystemDiagnosticsProcessPackageVersion)" />
647-
<PackageReferenceInclude="System.Diagnostics.TraceSource"Version="$(SystemDiagnosticsTraceSourcePackageVersion)" />
648-
<PackageReferenceInclude="System.Linq.Expressions"Version="$(SystemLinqExpressionsPackageVersion)" />
649-
<PackageReferenceInclude="System.Linq.Queryable"Version="$(SystemLinqExpressionsPackageVersion)" />
650-
<PackageReferenceInclude="System.Net.Requests"Version="$(SystemNetRequestsPackageVersion)" />
651-
<PackageReferenceInclude="System.Reflection.Emit"Version="$(SystemReflectionEmitPackageVersion)" />
652-
<PackageReferenceInclude="System.Reflection.Metadata"Version="$(SystemReflectionMetadataPackageVersion)" />
653-
<PackageReferenceInclude="System.Reflection.TypeExtensions"Version="$(SystemReflectionTypeExtensionsPackageVersion)" />
654-
<PackageReferenceInclude="System.Runtime"Version="$(SystemRuntimePackageVersion)" />
655-
<PackageReferenceInclude="System.Runtime.InteropServices"Version="$(SystemRuntimeInteropServicesPackageVersion)" />
656-
<PackageReferenceInclude="System.Runtime.Loader"Version="$(SystemRuntimeLoaderPackageVersion)" />
657-
<PackageReferenceInclude="System.Security.Cryptography.Algorithms"Version="$(SystemSecurityCryptographyAlgorithmsPackageVersion)" />
658-
<PackageReferenceInclude="System.Threading.Tasks.Parallel"Version="$(SystemThreadingTasksParallelPackageVersion)" />
659-
<PackageReferenceInclude="System.Threading.Thread"Version="$(SystemThreadingThreadPackageVersion)" />
660-
<PackageReferenceInclude="System.Threading.ThreadPool"Version="$(SystemThreadingThreadPoolPackageVersion)" />
661-
<PackageReferenceInclude="System.ValueTuple"Version="$(SystemValueTuplePackageVersion)" />
662-
</ItemGroup>
663-
664644
</Project>

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ and SolveTypEqualsTyp (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace
778778

779779
match sty1, sty2with
780780
// type vars inside forall-types may be alpha-equivalent
781-
| TType_var tp1, TType_var tp2when typarEq tp1 tp2||(aenv.EquivTypars.ContainsKey tp1&&typeEquiv gaenv.EquivTypars.[tp1] ty2)-> CompleteD
781+
| TType_var tp1, TType_var tp2when typarEq tp1 tp2||(matchaenv.EquivTypars.TryFind tp1with| Some vwhentypeEquiv gv ty2->true|_->false)-> CompleteD
782782

783783
| TType_var tp1, TType_var tp2when PreferUnifyTypar tp1 tp2-> SolveTyparEqualsTyp csenv ndeep m2 trace sty1 ty2
784784
| TType_var tp1, TType_var tp2whennot csenv.MatchingOnly&& PreferUnifyTypar tp2 tp1-> SolveTyparEqualsTyp csenv ndeep m2 trace sty2 ty1
@@ -850,12 +850,17 @@ and SolveTypSubsumesTyp (csenv:ConstraintSolverEnv) ndeep m2 (trace: OptionalTra
850850
letaenv= csenv.EquivEnv
851851
letdenv= csenv.DisplayEnv
852852
match sty1, sty2with
853-
| TType_var tp1,_when aenv.EquivTypars.ContainsKey tp1->
854-
SolveTypSubsumesTyp csenv ndeep m2 trace cxsln aenv.EquivTypars.[tp1] ty2
855-
856-
| TType_var r1, TType_var r2when typarEq r1 r2-> CompleteD
853+
| TType_var tp1,_->
854+
match aenv.EquivTypars.TryFind tp1with
855+
| Some v-> SolveTypSubsumesTyp csenv ndeep m2 trace cxsln v ty2
856+
|_->
857+
match sty2with
858+
| TType_var r2when typarEq tp1 r2-> CompleteD
859+
| TType_var rwhennot csenv.MatchingOnly-> SolveTyparSubtypeOfType csenv ndeep m2 trace r ty1
860+
|_-> SolveTypEqualsTypKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2
861+
857862
|_, TType_var rwhennot csenv.MatchingOnly-> SolveTyparSubtypeOfType csenv ndeep m2 trace r ty1
858-
| TType_var_,_-> SolveTypEqualsTypKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2
863+
859864
| TType_tuple(tupInfo1, l1), TType_tuple(tupInfo2, l2)->
860865
if evalTupInfoIsStruct tupInfo1<> evalTupInfoIsStruct tupInfo2then ErrorD(ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2))else
861866
SolveTypEqualsTypEqns csenv ndeep m2 trace cxsln l1 l2(* nb. can unify since no variance*)

‎src/fsharp/ExtensionTyping.fs‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,16 +1199,8 @@ module internal ExtensionTyping =
11991199
staticParameters|> Array.map(fun sp->
12001200
lettypeBeforeArgumentsName= typeBeforeArguments.PUntaint((fun st-> st.Name), m)
12011201
letspName= sp.PUntaint((fun sp-> sp.Name), m)
1202-
ifnot(argSpecsTable.ContainsKey spName)then
1203-
if sp.PUntaint((fun sp-> sp.IsOptional), m)then
1204-
match sp.PUntaint((fun sp-> sp.RawDefaultValue), m)with
1205-
|null-> error(Error(FSComp.SR.etStaticParameterRequiresAValue(spName, typeBeforeArgumentsName, typeBeforeArgumentsName, spName), range0))
1206-
| v-> v
1207-
else
1208-
error(Error(FSComp.SR.etProvidedTypeReferenceMissingArgument(spName), range0))
1209-
else
1210-
letarg= argSpecsTable.[spName]
1211-
1202+
match argSpecsTable.TryGetValue(spName)with
1203+
|true, arg->
12121204
/// Find the name of the representation type for the static parameter
12131205
letspReprTypeName=
12141206
sp.PUntaint((fun sp->
@@ -1232,7 +1224,16 @@ module internal ExtensionTyping =
12321224
|"System.Char"-> box(char arg)
12331225
|"System.Boolean"-> box(arg="True")
12341226
|"System.String"-> box(string arg)
1235-
| s-> error(Error(FSComp.SR.etUnknownStaticArgumentKind(s, typeLogicalName), range0)))
1227+
| s-> error(Error(FSComp.SR.etUnknownStaticArgumentKind(s, typeLogicalName), range0))
1228+
1229+
|_->
1230+
if sp.PUntaint((fun sp-> sp.IsOptional), m)then
1231+
match sp.PUntaint((fun sp-> sp.RawDefaultValue), m)with
1232+
|null-> error(Error(FSComp.SR.etStaticParameterRequiresAValue(spName, typeBeforeArgumentsName, typeBeforeArgumentsName, spName), range0))
1233+
| v-> v
1234+
else
1235+
error(Error(FSComp.SR.etProvidedTypeReferenceMissingArgument(spName), range0)))
1236+
12361237

12371238
match TryApplyProvidedType(typeBeforeArguments, None, staticArgs, range0)with
12381239
| Some(typeWithArguments, checkTypeName)->

‎src/fsharp/FSComp.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ lexIndentOffForML,"Consider using a file with extension '.ml' or '.mli' instead"
11131113
fscTooManyErrors,"Exiting - too many errors"
11141114
2001,docfileNoXmlSuffix,"The documentation file has no .xml suffix"
11151115
2002,fscNoImplementationFiles,"No implementation files specified"
1116-
2003,fscBadAssemblyVersion,"An %s specified version '%s', but this value is invalid and has been ignored"
1116+
2003,fscBadAssemblyVersion,"The attribute %s specified version '%s', but this value is invalid and has been ignored"
11171117
2004,fscTwoResourceManifests,"Conflicting options specified: 'win32manifest' and 'win32res'. Only one of these can be used."
11181118
2005,fscQuotationLiteralsStaticLinking,"The code in assembly '%s' makes uses of quotation literals. Static linking may not include components that make use of quotation literals unless all assemblies are compiled with at least F# 4.0."
11191119
2006,fscQuotationLiteralsStaticLinking0,"Code in this assembly makes uses of quotation literals. Static linking may not include components that make use of quotation literals unless all assemblies are compiled with at least F# 4.0."

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp