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

Commit0ff6e27

Browse files
author
dotnet-automerge-bot
authored
Merge pull requestdotnet#5727 from Microsoft/merges/master-to-dev16.0
Merge master to dev16.0
2 parents92e5820 +ac761b8 commit0ff6e27

26 files changed

+521
-508
lines changed

‎fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
<NoneInclude="App.config" />
7474
</ItemGroup>
7575
<ItemGroup>
76-
<PackageReferenceUpdate="FSharp.Core"Version="4.1.19" />
77-
<PackageReferenceInclude="FSharp.Core"Version="4.2.3" />
76+
<PackageReferenceInclude="FSharp.Core"Version="4.5.2" />
7877
<PackageReferenceInclude="Microsoft.NET.Test.Sdk"Version="15.6.0" />
7978
<PackageReferenceInclude="NUnit"Version="3.9.0" />
8079
<PackageReferenceInclude="NUnit3TestAdapter"Version="3.9.0" />

‎fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ProjectSdk="Microsoft.NET.Sdk">
1+
<ProjectSdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<FSharpSourcesRoot>$(MSBuildProjectDirectory)\..\..\src</FSharpSourcesRoot>
44
</PropertyGroup>
@@ -635,8 +635,7 @@
635635
</Compile>
636636
</ItemGroup>
637637
<ItemGroup>
638-
<PackageReferenceInclude="FSharp.Core"Version="4.1.19" />
639-
<PackageReferenceInclude="FSharp.Core"Version="4.1.18" />
638+
<PackageReferenceInclude="FSharp.Core"Version="4.5.2" />
640639
<PackageReferenceInclude="System.Collections.Immutable"Version="1.5.0" />
641640
<PackageReferenceInclude="System.Reflection.Metadata"Version="1.6.0" />
642641
</ItemGroup>

‎src/absil/illib.fs‎

Lines changed: 6 additions & 16 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)=
@@ -1123,7 +1117,7 @@ module NameMap =
11231117
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
11241118
moduleNameMultiMap=
11251119
letexistsInRange f(m:NameMultiMap<'T>)= NameMap.exists(fun _ l-> List.exists f l) m
1126-
letfind v(m:NameMultiMap<'T>)=matchMap.tryFind vmwithNone->[]|Some r->r
1120+
letfind v(m:NameMultiMap<'T>)=matchm.TryGetValue vwithtrue, r->r|_->[]
11271121
letadd v x(m:NameMultiMap<'T>)= NameMap.add v(x:: find v m) m
11281122
letrange(m:NameMultiMap<'T>)= Map.foldBack(fun _ x sofar-> x@ sofar) m[]
11291123
letrangeReversingEachBucket(m:NameMultiMap<'T>)= Map.foldBack(fun _ x sofar-> List.rev x@ sofar) m[]
@@ -1137,7 +1131,7 @@ module NameMultiMap =
11371131
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
11381132
moduleMultiMap=
11391133
letexistsInRange f(m:MultiMap<_,_>)= Map.exists(fun _ l-> List.exists f l) m
1140-
letfind v(m:MultiMap<_,_>)=matchMap.tryFind vmwithNone->[]|Some r->r
1134+
letfind v(m:MultiMap<_,_>)=matchm.TryGetValue vwithtrue, r->r|_->[]
11411135
letadd v x(m:MultiMap<_,_>)= Map.add v(x:: find v m) m
11421136
letrange(m:MultiMap<_,_>)= Map.foldBack(fun _ x sofar-> x@ sofar) m[]
11431137
letempty:MultiMap<_,_>= Map.empty
@@ -1148,11 +1142,6 @@ type LayeredMap<'Key,'Value when 'Key : comparison> = Map<'Key,'Value>
11481142
typeMap<'Key,'Valuewhen'Key:comparison>with
11491143
static memberEmpty:Map<'Key,'Value>= Map.empty
11501144

1151-
memberm.TryGetValue(key,res:byref<'Value>)=
1152-
match m.TryFind keywith
1153-
| None->false
1154-
| Some r-> res<- r;true
1155-
11561145
memberx.Values=[for(KeyValue(_,v))in x-> v]
11571146
memberx.AddAndMarkAsCollapsible(kvs:_[])=(x,kvs)||> Array.fold(fun x(KeyValue(k,v))-> x.Add(k,v))
11581147
memberx.LinearTryModifyThenLaterFlatten(key,f:'Value option->'Value)= x.Add(key, f(x.TryFind key))
@@ -1162,12 +1151,13 @@ type Map<'Key,'Value when 'Key : comparison> with
11621151
[<Sealed>]
11631152
typeLayeredMultiMap<'Key,'Valuewhen'Key:equalityand'Key:comparison>(contents:LayeredMap<'Key,'Value list>)=
11641153
memberx.Add(k,v)= LayeredMultiMap(contents.Add(k,v:: x.[k]))
1165-
memberx.Itemwith get k=match contents.TryFind kwithNone->[]|Some l->l
1154+
memberx.Itemwith get k=match contents.TryGetValue kwithtrue, l->l|_->[]
11661155
memberx.AddAndMarkAsCollapsible(kvs:_[])=
11671156
letx=(x,kvs)||> Array.fold(fun x(KeyValue(k,v))-> x.Add(k,v))
11681157
x.MarkAsCollapsible()
11691158
memberx.MarkAsCollapsible()= LayeredMultiMap(contents.MarkAsCollapsible())
11701159
memberx.TryFind k= contents.TryFind k
1160+
memberx.TryGetValue k= contents.TryGetValue k
11711161
memberx.Values= contents.Values|> List.concat
11721162
static memberEmpty:LayeredMultiMap<'Key,'Value>= LayeredMultiMap LayeredMap.Empty
11731163

‎src/fsharp/AccessibilityLogic.fs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,10 @@ let CheckTyconReprAccessible amap m ad tcref =
194194

195195
/// Indicates if a type is accessible (both definition and instantiation)
196196
let recIsTypeAccessible g amap m ad ty=
197-
not(isAppTy g ty)||
198-
lettcref,tinst= destAppTy g ty
199-
IsEntityAccessible amap m ad tcref&& IsTypeInstAccessible g amap m ad tinst
197+
match tryAppTy g tywith
198+
| ValueNone->true
199+
| ValueSome(tcref, tinst)->
200+
IsEntityAccessible amap m ad tcref&& IsTypeInstAccessible g amap m ad tinst
200201

201202
andIsTypeInstAccessible g amap m ad tinst=
202203
match tinstwith
@@ -210,7 +211,7 @@ let IsProvidedMemberAccessible (amap:Import.ImportMap) m ad ty access =
210211
ifnot isTyAccessiblethenfalse
211212
else
212213
not(isAppTy g ty)||
213-
lettcrefOfViewedItem,_= destAppTy g ty
214+
lettcrefOfViewedItem= tcrefOfAppTy g ty
214215
IsILMemberAccessible g amap m tcrefOfViewedItem ad access
215216

216217
/// Compute the accessibility of a provided member

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ and SolveTypStaticReq (csenv:ConstraintSolverEnv) trace req ty =
474474
IterateD(fun((tpr:Typar),_)-> SolveTypStaticReqTypar csenv trace req tpr) vs
475475
|_->
476476
match tryAnyParTy csenv.g tywith
477-
|Some tpr-> SolveTypStaticReqTypar csenv trace req tpr
478-
|None-> CompleteD
477+
|ValueSome tpr-> SolveTypStaticReqTypar csenv trace req tpr
478+
|ValueNone-> CompleteD
479479

480480
letTransactDynamicReq(trace:OptionalTrace)(tpr:Typar)req=
481481
letorig= tpr.DynamicReq
@@ -487,7 +487,7 @@ let SolveTypDynamicReq (csenv:ConstraintSolverEnv) trace req ty =
487487
| TyparDynamicReq.No-> CompleteD
488488
| TyparDynamicReq.Yes->
489489
match tryAnyParTy csenv.g tywith
490-
|Some tprwhen tpr.DynamicReq<> TyparDynamicReq.Yes->
490+
|ValueSome tprwhen tpr.DynamicReq<> TyparDynamicReq.Yes->
491491
TransactDynamicReq trace tpr TyparDynamicReq.Yes
492492
|_-> CompleteD
493493

@@ -499,7 +499,7 @@ let TransactIsCompatFlex (trace:OptionalTrace) (tpr:Typar) req =
499499
letSolveTypIsCompatFlex(csenv:ConstraintSolverEnv)trace req ty=
500500
if reqthen
501501
match tryAnyParTy csenv.g tywith
502-
|Some tprwhennot tpr.IsCompatFlex-> TransactIsCompatFlex trace tpr req
502+
|ValueSome tprwhennot tpr.IsCompatFlex-> TransactIsCompatFlex trace tpr req
503503
|_-> CompleteD
504504
else
505505
CompleteD
@@ -687,8 +687,8 @@ let CheckWarnIfRigid (csenv:ConstraintSolverEnv) ty1 (r:Typar) ty =
687687
ifnot r.Rigidity.WarnIfUnifiedthen CompleteDelse
688688
letneedsWarning=
689689
match tryAnyParTy g tywith
690-
|None->true
691-
|Some tp2->
690+
|ValueNone->true
691+
|ValueSome tp2->
692692
not tp2.IsCompilerGenerated&&
693693
(r.IsCompilerGenerated||
694694
// exclude this warning for two identically named user-specified type parameters, e.g. from different mutually recursive functions or types
@@ -758,8 +758,8 @@ and solveTypMeetsTyparConstraints (csenv:ConstraintSolverEnv) ndeep m2 trace ty
758758
CompleteD
759759
else
760760
match tryDestTyparTy g tywith
761-
|None-> CompleteD
762-
|Some destTypar->
761+
|ValueNone-> CompleteD
762+
|ValueSome destTypar->
763763
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.DefaultsTo(priority, dty, m))
764764

765765
| TyparConstraint.SupportsNull m2-> SolveTypeSupportsNull csenv ndeep m2 trace ty
@@ -1458,7 +1458,7 @@ and GetRelevantMethodsForTrait (csenv:ConstraintSolverEnv) permitWeakResolution
14581458

14591459
/// The nominal support of the member constraint
14601460
andGetSupportOfMemberConstraint(csenv:ConstraintSolverEnv)(TTrait(tys,_,_,_,_,_))=
1461-
tys|> List.choose(tryAnyParTy csenv.g)
1461+
tys|> List.choose(tryAnyParTyOption csenv.g)
14621462

14631463
/// All the typars relevant to the member constraint *)
14641464
andGetFreeTyparsOfMemberConstraint(csenv:ConstraintSolverEnv)(TTrait(tys,_,_,argtys,rty,_))=
@@ -1475,9 +1475,9 @@ and SolveRelevantMemberConstraints (csenv:ConstraintSolverEnv) ndeep permitWeakR
14751475
/// Normalize the typar
14761476
letty= mkTyparTy tp
14771477
match tryAnyParTy csenv.g tywith
1478-
|Some tp->
1478+
|ValueSome tp->
14791479
SolveRelevantMemberConstraintsForTypar csenv ndeep permitWeakResolution trace tp
1480-
|None->
1480+
|ValueNone->
14811481
ResultDfalse))
14821482

14831483
andSolveRelevantMemberConstraintsForTypar(csenv:ConstraintSolverEnv)ndeep permitWeakResolution(trace:OptionalTrace)tp=
@@ -1690,9 +1690,9 @@ and SolveTypeSupportsNull (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
16901690
letm= csenv.m
16911691
letdenv= csenv.DisplayEnv
16921692
match tryDestTyparTy g tywith
1693-
|Some destTypar->
1693+
|ValueSome destTypar->
16941694
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.SupportsNull m)
1695-
|None->
1695+
|ValueNone->
16961696
if TypeSatisfiesNullConstraint g m tythen CompleteDelse
16971697
match tywith
16981698
| NullableTy g_->
@@ -1706,12 +1706,12 @@ and SolveTypeSupportsComparison (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
17061706
letamap= csenv.amap
17071707
letdenv= csenv.DisplayEnv
17081708
match tryDestTyparTy g tywith
1709-
|Some destTypar->
1709+
|ValueSome destTypar->
17101710
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.SupportsComparison m)
1711-
|None->
1711+
|ValueNone->
17121712
// Check it isn't ruled out by the user
17131713
match tryDestAppTy g tywith
1714-
|Some tcrefwhen HasFSharpAttribute g g.attrib_NoComparisonAttribute tcref.Attribs->
1714+
|ValueSome tcrefwhen HasFSharpAttribute g g.attrib_NoComparisonAttribute tcref.Attribs->
17151715
ErrorD(ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportComparison1(NicePrint.minimalStringOfType denv ty), m, m2))
17161716
|_->
17171717
match tywith
@@ -1750,11 +1750,11 @@ and SolveTypeSupportsEquality (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
17501750
letm= csenv.m
17511751
letdenv= csenv.DisplayEnv
17521752
match tryDestTyparTy g tywith
1753-
|Some destTypar->
1753+
|ValueSome destTypar->
17541754
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.SupportsEquality m)
1755-
|None->
1755+
|_->
17561756
match tryDestAppTy g tywith
1757-
|Some tcrefwhen HasFSharpAttribute g g.attrib_NoEqualityAttribute tcref.Attribs->
1757+
|ValueSome tcrefwhen HasFSharpAttribute g g.attrib_NoEqualityAttribute tcref.Attribs->
17581758
ErrorD(ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportEquality1(NicePrint.minimalStringOfType denv ty), m, m2))
17591759
|_->
17601760
match tywith
@@ -1787,9 +1787,9 @@ and SolveTypeIsEnum (csenv:ConstraintSolverEnv) ndeep m2 trace ty underlying =
17871787
letm= csenv.m
17881788
letdenv= csenv.DisplayEnv
17891789
match tryDestTyparTy g tywith
1790-
|Some destTypar->
1790+
|ValueSome destTypar->
17911791
return! AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.IsEnum(underlying, m))
1792-
|None->
1792+
|_->
17931793
if isEnumTy g tythen
17941794
do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace underlying(underlyingTypeOfEnumTy g ty)
17951795
return! CompleteD
@@ -1803,9 +1803,9 @@ and SolveTypeIsDelegate (csenv:ConstraintSolverEnv) ndeep m2 trace ty aty bty =
18031803
letm= csenv.m
18041804
letdenv= csenv.DisplayEnv
18051805
match tryDestTyparTy g tywith
1806-
|Some destTypar->
1806+
|ValueSome destTypar->
18071807
return! AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.IsDelegate(aty, bty, m))
1808-
|None->
1808+
|_->
18091809
if isDelegateTy g tythen
18101810
match TryDestStandardDelegateType csenv.InfoReader m AccessibleFromSomewhere tywith
18111811
| Some(tupledArgTy, rty)->
@@ -1823,9 +1823,9 @@ and SolveTypeIsNonNullableValueType (csenv:ConstraintSolverEnv) ndeep m2 trace t
18231823
letm= csenv.m
18241824
letdenv= csenv.DisplayEnv
18251825
match tryDestTyparTy g tywith
1826-
|Some destTypar->
1826+
|ValueSome destTypar->
18271827
return! AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.IsNonNullableStruct m)
1828-
|None->
1828+
|_->
18291829
letunderlyingTy= stripTyEqnsAndMeasureEqns g ty
18301830
if isStructTy g underlyingTythen
18311831
if tyconRefEq g g.system_Nullable_tcref(tcrefOfAppTy g underlyingTy)then
@@ -1839,9 +1839,9 @@ and SolveTypeIsUnmanaged (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
18391839
letm= csenv.m
18401840
letdenv= csenv.DisplayEnv
18411841
match tryDestTyparTy g tywith
1842-
|Some destTypar->
1842+
|ValueSome destTypar->
18431843
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.IsUnmanaged m)
1844-
|None->
1844+
|_->
18451845
if isUnmanagedTy g tythen
18461846
CompleteD
18471847
else
@@ -1853,9 +1853,9 @@ and SolveTypeChoice (csenv:ConstraintSolverEnv) ndeep m2 trace ty tys =
18531853
letm= csenv.m
18541854
letdenv= csenv.DisplayEnv
18551855
match tryDestTyparTy g tywith
1856-
|Some destTypar->
1856+
|ValueSome destTypar->
18571857
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.SimpleChoice(tys, m))
1858-
|None->
1858+
|_->
18591859
if List.exists(typeEquivAux Erasure.EraseMeasures g ty) tysthen CompleteD
18601860
else ErrorD(ConstraintSolverError(FSComp.SR.csTypeNotCompatibleBecauseOfPrintf((NicePrint.minimalStringOfType denv ty),(String.concat","(List.map(NicePrint.prettyStringOfTy denv) tys))), m, m2))
18611861

@@ -1865,9 +1865,9 @@ and SolveTypeIsReferenceType (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
18651865
letm= csenv.m
18661866
letdenv= csenv.DisplayEnv
18671867
match tryDestTyparTy g tywith
1868-
|Some destTypar->
1868+
|ValueSome destTypar->
18691869
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.IsReferenceType m)
1870-
|None->
1870+
|_->
18711871
if isRefTy g tythen CompleteD
18721872
else ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresReferenceSemantics(NicePrint.minimalStringOfType denv ty), m, m))
18731873

@@ -1878,23 +1878,23 @@ and SolveTypeRequiresDefaultConstructor (csenv:ConstraintSolverEnv) ndeep m2 tra
18781878
letdenv= csenv.DisplayEnv
18791879
letty= stripTyEqnsAndMeasureEqns g origTy
18801880
match tryDestTyparTy g tywith
1881-
|Some destTypar->
1881+
|ValueSome destTypar->
18821882
AddConstraint csenv ndeep m2 trace destTypar(TyparConstraint.RequiresDefaultConstructor m)
1883-
|None->
1883+
|_->
18841884
if isStructTy g ty&& TypeHasDefaultValue g m tythen
18851885
CompleteD
18861886
else
18871887
if GetIntrinsicConstructorInfosOfType csenv.InfoReader m ty
18881888
|> List.exists(fun x-> x.IsNullary&& IsMethInfoAccessible amap m AccessibleFromEverywhere x)
18891889
then
18901890
match tryDestAppTy g tywith
1891-
|Some tcrefwhen HasFSharpAttribute g g.attrib_AbstractClassAttribute tcref.Attribs->
1891+
|ValueSome tcrefwhen HasFSharpAttribute g g.attrib_AbstractClassAttribute tcref.Attribs->
18921892
ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresNonAbstract(NicePrint.minimalStringOfType denv origTy), m, m2))
18931893
|_->
18941894
CompleteD
18951895
else
18961896
match tryDestAppTy g tywith
1897-
|Some tcrefwhen
1897+
|ValueSome tcrefwhen
18981898
tcref.PreEstablishedHasDefaultConstructor||
18991899
// F# 3.1 feature: records with CLIMutable attribute should satisfy 'default constructor' constraint
19001900
(tcref.IsRecordTycon&& HasFSharpAttribute g g.attrib_CLIMutableAttribute tcref.Attribs)->
@@ -2324,7 +2324,7 @@ and ResolveOverloading
23242324

23252325
// Func<_> is always considered better than any other delegate type
23262326
match tryDestAppTy csenv.g ty1with
2327-
|Some tcref1when
2327+
|ValueSome tcref1when
23282328
tcref1.DisplayName="Func"&&
23292329
(match tcref1.PublicPathwith Some p-> p.EnclosingPath=[|"System"|]|_->false)&&
23302330
isDelegateTy g ty1&&
@@ -2657,7 +2657,7 @@ let CodegenWitnessThatTypeSupportsTraitConstraint tcVal g amap m (traitInfo:Trai
26572657
match slnwith
26582658
| ILMethSln(origTy, extOpt, mref, minst)->
26592659
letmetadataTy= convertToTypeWithMetadataIfPossible g origTy
2660-
lettcref,_tinst= destAppTy g metadataTy
2660+
lettcref= tcrefOfAppTy g metadataTy
26612661
letmdef= IL.resolveILMethodRef tcref.ILTyconRawMetadata mref
26622662
letilMethInfo=
26632663
match extOptwith

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp