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

Commit2f5befa

Browse files
author
dotnet-automerge-bot
authored
Merge pull requestdotnet#5722 from Microsoft/merges/master-to-dev16.0
Merge master to dev16.0
2 parents1cc5bd9 +f79da20 commit2f5befa

File tree

10 files changed

+86
-118
lines changed

10 files changed

+86
-118
lines changed

‎VisualFSharp.sln‎

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion =15.0.27130.2036
4+
VisualStudioVersion =15.0.28010.2036
55
MinimumVisualStudioVersion =10.0.40219.1
6+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") ="FSharp.VS.FSI","vsintegration\src\FSharp.VS.FSI\FSharp.VS.FSI.fsproj","{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}"
7+
EndProject
68
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="FSharp.Compiler.Private","src\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj","{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}"
79
EndProject
8-
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") ="FSharp.VS.FSI","vsintegration\src\FSharp.VS.FSI\FSharp.VS.FSI.fsproj","{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}"
9-
ProjectSection(ProjectDependencies) =postProject
10-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3} ={2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}
11-
EndProjectSection
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") ="VisualFSharpFull","vsintegration\Vsix\VisualFSharpFull\VisualFSharpFull.csproj","{59ADCE46-9740-4079-834D-9A03A3494EBC}"
1211
EndProject
1312
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="FSharp.Compiler.Server.Shared","src\fsharp\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj","{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}"
1413
EndProject
@@ -65,14 +64,8 @@ EndProject
6564
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="FSharp.Compiler.Interactive.Settings","src\fsharp\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj","{649FA588-F02E-457C-9FCF-87E46407481E}"
6665
EndProject
6766
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="FsiAnyCPU","src\fsharp\fsiAnyCpu\FsiAnyCPU.fsproj","{8B3E283D-B5FE-4055-9D80-7E3A32F3967B}"
68-
ProjectSection(ProjectDependencies) =postProject
69-
{649FA588-F02E-457C-9FCF-87E46407481E} ={649FA588-F02E-457C-9FCF-87E46407481E}
70-
EndProjectSection
7167
EndProject
7268
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="Fsi","src\fsharp\fsi\Fsi.fsproj","{D0E98C0D-490B-4C61-9329-0862F6E87645}"
73-
ProjectSection(ProjectDependencies) =postProject
74-
{649FA588-F02E-457C-9FCF-87E46407481E} ={649FA588-F02E-457C-9FCF-87E46407481E}
75-
EndProjectSection
7669
EndProject
7770
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="FSharp.Tests.FSharpSuite","tests\fsharp\FSharp.Tests.FSharpSuite.fsproj","{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
7871
EndProject
@@ -115,10 +108,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextFile", "vsintegration\I
115108
EndProject
116109
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") ="XMLFile","vsintegration\ItemTemplates\XMLFile\XMLFile.csproj","{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}"
117110
EndProject
118-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") ="Vsix","Vsix","{141F6C23-E1B1-4D89-9F10-F0B8AD58E71F}"
119-
EndProject
120-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") ="VisualFSharpFull","vsintegration\Vsix\VisualFSharpFull\VisualFSharpFull.csproj","{59ADCE46-9740-4079-834D-9A03A3494EBC}"
121-
EndProject
122111
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="HostedCompilerServer","tests\fsharpqa\testenv\src\HostedCompilerServer\HostedCompilerServer.fsproj","{4239EFEA-E746-446A-BF7A-51FCBAB13946}"
123112
EndProject
124113
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") ="ILComparer","tests\fsharpqa\testenv\src\ILComparer\ILComparer.fsproj","{2E60864A-E3FF-4BCC-810F-DC7C34E6B236}"
@@ -155,14 +144,6 @@ Global
155144
Release|x86=Release|x86
156145
EndGlobalSection
157146
GlobalSection(ProjectConfigurationPlatforms) =postSolution
158-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
159-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.Build.0=Debug|Any CPU
160-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|x86.ActiveCfg=Debug|Any CPU
161-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|x86.Build.0=Debug|Any CPU
162-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.ActiveCfg=Release|Any CPU
163-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.Build.0=Release|Any CPU
164-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|x86.ActiveCfg=Release|Any CPU
165-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|x86.Build.0=Release|Any CPU
166147
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
167148
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}.Debug|Any CPU.Build.0=Debug|Any CPU
168149
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}.Debug|x86.ActiveCfg=Debug|Any CPU
@@ -171,6 +152,22 @@ Global
171152
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}.Release|Any CPU.Build.0=Release|Any CPU
172153
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}.Release|x86.ActiveCfg=Release|Any CPU
173154
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519}.Release|x86.Build.0=Release|Any CPU
155+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
156+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.Build.0=Debug|Any CPU
157+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|x86.ActiveCfg=Debug|Any CPU
158+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|x86.Build.0=Debug|Any CPU
159+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.ActiveCfg=Release|Any CPU
160+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.Build.0=Release|Any CPU
161+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|x86.ActiveCfg=Release|Any CPU
162+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|x86.Build.0=Release|Any CPU
163+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
164+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|Any CPU.Build.0=Debug|Any CPU
165+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|x86.ActiveCfg=Debug|Any CPU
166+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|x86.Build.0=Debug|Any CPU
167+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.ActiveCfg=Release|Any CPU
168+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.Build.0=Release|Any CPU
169+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.ActiveCfg=Release|Any CPU
170+
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.Build.0=Release|Any CPU
174171
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
175172
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0=Debug|Any CPU
176173
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg=Debug|Any CPU
@@ -483,14 +480,6 @@ Global
483480
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Release|Any CPU.Build.0=Release|Any CPU
484481
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Release|x86.ActiveCfg=Release|Any CPU
485482
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6}.Release|x86.Build.0=Release|Any CPU
486-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
487-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|Any CPU.Build.0=Debug|Any CPU
488-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|x86.ActiveCfg=Debug|Any CPU
489-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Debug|x86.Build.0=Debug|Any CPU
490-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.ActiveCfg=Release|Any CPU
491-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.Build.0=Release|Any CPU
492-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.ActiveCfg=Release|Any CPU
493-
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.Build.0=Release|Any CPU
494483
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|Any CPU.ActiveCfg=Debug|Any CPU
495484
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|Any CPU.Build.0=Debug|Any CPU
496485
{4239EFEA-E746-446A-BF7A-51FCBAB13946}.Debug|x86.ActiveCfg=Debug|Any CPU
@@ -584,8 +573,9 @@ Global
584573
HideSolutionNode =FALSE
585574
EndGlobalSection
586575
GlobalSection(NestedProjects) =preSolution
587-
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3} ={3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
588576
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519} ={4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
577+
{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3} ={3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
578+
{59ADCE46-9740-4079-834D-9A03A3494EBC} ={4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
589579
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} ={B8DDA694-7939-42E3-95E5-265C2217C142}
590580
{DED3BBD7-53F4-428A-8C9F-27968E768605} ={3058BC79-8E79-4645-B05D-48CC182FA8A6}
591581
{EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F} ={4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
@@ -629,8 +619,6 @@ Global
629619
{E3FDD4AC-46B6-4B9F-B672-317D1202CC50} ={F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
630620
{D11FC318-8F5D-4C8C-9287-AB40A016D13C} ={F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
631621
{1FB1DD07-06AA-45B4-B5AC-20FF5BEE98B6} ={F6DAEE9A-8BE1-4C4A-BC83-09215517C7DA}
632-
{141F6C23-E1B1-4D89-9F10-F0B8AD58E71F} ={4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
633-
{59ADCE46-9740-4079-834D-9A03A3494EBC} ={141F6C23-E1B1-4D89-9F10-F0B8AD58E71F}
634622
{4239EFEA-E746-446A-BF7A-51FCBAB13946} ={CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
635623
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236} ={CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
636624
{D086C8C6-D00D-4C3B-9AB2-A4286C9F5922} ={4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}

‎src/absil/il.fs‎

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,11 @@ let unsplitTypeName (ns, n) =
154154
|[]-> String.concat"." ns+"."+ n
155155
|_-> n
156156

157-
letsplitTypeNameRightAux nm=
158-
if String.contains nm'.'then
159-
letidx= String.rindex nm'.'
160-
lets1,s2= splitNameAt nm idx
161-
Some s1, s2
162-
else None, nm
157+
letsplitTypeNameRightAux(nm:string)=
158+
letidx= nm.LastIndexOf'.'
159+
if idx=-1then None, nmelse
160+
lets1,s2= splitNameAt nm idx
161+
Some s1, s2
163162

164163
letsplitTypeNameRight nm=
165164
memoizeNamespaceRightTable.GetOrAdd(nm, splitTypeNameRightAux)
@@ -4189,23 +4188,6 @@ let resolveILMethodRef td mref = resolveILMethodRefWithRescope id td mref
41894188
letmkRefToILModule m=
41904189
ILModuleRef.Create(m.Name,true, None)
41914190

4192-
4193-
letungenericizeTypeName n=
4194-
letsym='`'
4195-
if
4196-
String.contains n sym&&
4197-
(* check what comes after the symbol is a number*)
4198-
(letm= String.rindex n sym
4199-
letres= ref(m< n.Length-1)
4200-
for i= m+1to n.Length-1do
4201-
res:=!res&& n.[i]>='0'&& n.[i]<='9'
4202-
!res)
4203-
then
4204-
letpos= String.rindex n sym
4205-
String.sub n0 pos
4206-
else n
4207-
4208-
42094191
typeILEventRef=
42104192
{ erA:ILTypeRef; erB:string}
42114193
static memberCreate(a,b)={erA=a;erB=b}

‎src/absil/il.fsi‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,6 @@ val typeNameForGlobalFunctions: string
15401540

15411541
val isTypeNameForGlobalFunctions: string-> bool
15421542

1543-
val ungenericizeTypeName: string-> string(* e.g. List`1--> List*)
1544-
1545-
15461543
//====================================================================
15471544
// PART 2
15481545
//

‎src/absil/illib.fs‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -452,23 +452,13 @@ type String with
452452
member inlinex.EndsWithOrdinal(value)=
453453
x.EndsWith(value, StringComparison.Ordinal)
454454

455-
moduleString=
456-
letindexNotFound()= raise(new KeyNotFoundException("An index for the character was not found in the string"))
457-
455+
moduleString=
458456
letmake(n:int)(c:char):string=new String(c, n)
459457

460458
letget(str:string)i= str.[i]
461459

462460
letsub(s:string)(start:int)(len:int)= s.Substring(start,len)
463461

464-
letindex(s:string)(c:char)=
465-
letr= s.IndexOf(c)
466-
if r=-1then indexNotFound()else r
467-
468-
letrindex(s:string)(c:char)=
469-
letr= s.LastIndexOf(c)
470-
if r=-1then indexNotFound()else r
471-
472462
letcontains(s:string)(c:char)= s.IndexOf(c)<>-1
473463

474464
letorder= LanguagePrimitives.FastGenericComparer<string>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3082,7 +3082,7 @@
30823082
<value>This number is outside the allowable range for 32-bit floats</value>
30833083
</data>
30843084
<dataname="lexInvalidNumericLiteral"xml:space="preserve">
3085-
<value>This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger).</value>
3085+
<value>This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16),1us (uint16),1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger).</value>
30863086
</data>
30873087
<dataname="lexInvalidByteLiteral"xml:space="preserve">
30883088
<value>This is not a valid byte literal</value>
@@ -4378,4 +4378,4 @@
43784378
<dataname="chkInvalidFunctionReturnType"xml:space="preserve">
43794379
<value>The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL.</value>
43804380
</data>
4381-
</root>
4381+
</root>

‎src/fsharp/CompileOps.fs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,13 +2609,13 @@ type TcConfigBuilder =
26092609
membertcConfigB.RemoveReferencedAssemblyByPath(m,path)=
26102610
tcConfigB.referencedDLLs<- tcConfigB.referencedDLLs|> List.filter(fun ar-> ar.Range<> m|| ar.Text<> path)
26112611

2612-
static memberSplitCommandLineResourceInfori=
2613-
if String.contains ri','then
2614-
letp= String.index ri','
2612+
static memberSplitCommandLineResourceInfo(ri:string)=
2613+
letp= ri.IndexOf','
2614+
if p<>-1then
26152615
letfile= String.sub ri0 p
26162616
letrest= String.sub ri(p+1)(String.length ri- p-1)
2617-
if String.containsrest','then
2618-
letp= String.index rest','
2617+
letp=rest.IndexOf','
2618+
if p<>-1then
26192619
letname= String.sub rest0 p+".resources"
26202620
letpubpri= String.sub rest(p+1)(rest.Length- p-1)
26212621
if pubpri="public"then file, name, ILResourceAccess.Public

‎src/fsharp/NameResolution.fs‎

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -985,10 +985,8 @@ type TypeNameResolutionStaticArgsInfo =
985985

986986
// Get the first possible mangled name of the type, assuming the args are generic args
987987
memberx.MangledNameForType nm=
988-
if IsMangledGenericName nm|| x.NumStaticArgs=0then nm
989-
else nm+"`"+string x.NumStaticArgs
990-
991-
988+
if x.NumStaticArgs=0|| TryDemangleGenericNameAndPos nm<> ValueNonethen nm
989+
else nm+"`"+ string x.NumStaticArgs
992990

993991
[<NoEquality; NoComparison>]
994992
/// Represents information which guides name resolution of types.
@@ -1018,7 +1016,11 @@ let LookupTypeNameInEntityHaveArity nm (staticResInfo: TypeNameResolutionStaticA
10181016
/// Unqualified lookups of type names where the number of generic arguments is known
10191017
/// from context, e.g. List<arg>. Rebindings due to 'open' may have rebound identifiers.
10201018
letLookupTypeNameInEnvHaveArity fq nm numTyArgs(nenv:NameResolutionEnv)=
1021-
letkey=if IsMangledGenericName nmthen DecodeGenericTypeName nmelse NameArityPair(nm,numTyArgs)
1019+
letkey=
1020+
match TryDemangleGenericNameAndPos nmwith
1021+
| ValueSome pos-> DecodeGenericTypeName pos nm
1022+
|_-> NameArityPair(nm,numTyArgs)
1023+
10221024
match nenv.TyconsByDemangledNameAndArity(fq).TryFind(key)with
10231025
| Some res-> Some res
10241026
| None-> nenv.TyconsByAccessNames(fq).TryFind nm|> Option.map List.head
@@ -1041,15 +1043,17 @@ let LookupTypeNameInEnvHaveArity fq nm numTyArgs (nenv:NameResolutionEnv) =
10411043
// also be used to qualify access if needed, though this is almost never needed.
10421044

10431045
letLookupTypeNameNoArity nm(byDemangledNameAndArity:LayeredMap<NameArityPair,_>)(byAccessNames:LayeredMultiMap<string,_>)=
1044-
if IsMangledGenericName nmthen
1045-
match byDemangledNameAndArity.TryFind(DecodeGenericTypeName nm)with
1046-
| Some res->[res]
1047-
| None->
1048-
match byAccessNames.TryFind nmwith
1049-
| Some res-> res
1050-
| None->[]
1051-
else
1052-
byAccessNames.[nm]
1046+
match TryDemangleGenericNameAndPos nmwith
1047+
| ValueSome pos->
1048+
letdemangled= DecodeGenericTypeName pos nm
1049+
match byDemangledNameAndArity.TryFind demangledwith
1050+
| Some res->[res]
1051+
| None->
1052+
match byAccessNames.TryFind nmwith
1053+
| Some res-> res
1054+
| None->[]
1055+
|_->
1056+
byAccessNames.[nm]
10531057

10541058
/// Qualified lookup of type names in the environment
10551059
letLookupTypeNameInEnvNoArity fq nm(nenv:NameResolutionEnv)=

‎src/fsharp/NicePrint.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module private PrintIL =
102102
openMicrosoft.FSharp.Compiler.AbstractIL.IL
103103

104104
letfullySplitILTypeRef(tref:ILTypeRef)=
105-
(List.collect IL.splitNamespace(tref.Enclosing@[IL.ungenericizeTypeName tref.Name]))
105+
(List.collect IL.splitNamespace(tref.Enclosing@[PrettyNaming.DemangleGenericTypeName tref.Name]))
106106

107107
letlayoutILTypeRefName denv path=
108108
letpath=
@@ -193,7 +193,7 @@ module private PrintIL =
193193
letargs= signatur.ArgTypes|> List.map(layoutILType denv ilTyparSubst)
194194
letres=
195195
match conswith
196-
| Some className-> layoutILTypeRefName denv(SplitNamesForILPath(ungenericizeTypeName className))^^(pruneParms className ilTyparSubst|> paramsL)// special case for constructor return-type (viz., the class itself)
196+
| Some className-> layoutILTypeRefName denv(SplitNamesForILPath(PrettyNaming.DemangleGenericTypeName className))^^(pruneParms className ilTyparSubst|> paramsL)// special case for constructor return-type (viz., the class itself)
197197
| None-> signatur.ReturnType|> layoutILType denv ilTyparSubst
198198
match argswith
199199
|[]-> WordL.structUnit^^ WordL.arrow^^ res
@@ -226,7 +226,7 @@ module private PrintIL =
226226
// return type be passed along as the `cons` parameter.)
227227
letres=
228228
match conswith
229-
| Some className-> layoutILTypeRefName denv(SplitNamesForILPath(ungenericizeTypeName className))^^(pruneParms className ilTyparSubst|> paramsL)// special case for constructor return-type (viz., the class itself)
229+
| Some className-> layoutILTypeRefName denv(SplitNamesForILPath(PrettyNaming.DemangleGenericTypeName className))^^(pruneParms className ilTyparSubst|> paramsL)// special case for constructor return-type (viz., the class itself)
230230
| None-> retType|> layoutILType denv ilTyparSubst
231231
match parameterswith
232232
|[]-> WordL.structUnit^^ WordL.arrow^^ res

‎src/fsharp/PrettyNaming.fs‎

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -484,30 +484,36 @@ module public Microsoft.FSharp.Compiler.PrettyNaming
484484

485485
let [<Literal>]privatemangledGenericTypeNameSym='`'
486486

487-
letIsMangledGenericName(n:string)=
488-
n.IndexOf mangledGenericTypeNameSym<>-1&&
487+
letTryDemangleGenericNameAndPos(n:string)=
489488
(* check what comes after the symbol is a number*)
490-
letm= n.LastIndexOf mangledGenericTypeNameSym
491-
let mutableres= m< n.Length-1
492-
for i= m+1to n.Length-1do
493-
res<- res&& n.[i]>='0'&& n.[i]<='9'
494-
res
489+
letpos= n.LastIndexOf mangledGenericTypeNameSym
490+
if pos=-1then ValueNoneelse
491+
let mutableres= pos< n.Length-1
492+
let mutablei= pos+1
493+
while res&& i< n.Lengthdo
494+
letchar= n.[i]
495+
ifnot(char>='0'&& char<='9')then
496+
res<-false
497+
i<- i+1
498+
if resthen
499+
ValueSome pos
500+
else
501+
ValueNone
495502

496503
typeNameArityPair= NameArityPairofstring*int
497504

498-
letDecodeGenericTypeName n=
499-
if IsMangledGenericName nthen
500-
letpos= n.LastIndexOf mangledGenericTypeNameSym
501-
letres= n.Substring(0,pos)
502-
letnum= n.Substring(pos+1,n.Length- pos-1)
503-
NameArityPair(res, int32 num)
504-
else NameArityPair(n,0)
505-
506-
letDemangleGenericTypeName n=
507-
if IsMangledGenericName nthen
508-
letpos= n.LastIndexOf mangledGenericTypeNameSym
509-
n.Substring(0,pos)
510-
else n
505+
letDecodeGenericTypeName pos(mangledName:string)=
506+
letres= mangledName.Substring(0,pos)
507+
letnum= mangledName.Substring(pos+1,mangledName.Length- pos-1)
508+
NameArityPair(res, int32 num)
509+
510+
letDemangleGenericTypeNameWithPos pos(mangledName:string)=
511+
mangledName.Substring(0,pos)
512+
513+
letDemangleGenericTypeName(mangledName:string)=
514+
match TryDemangleGenericNameAndPos mangledNamewith
515+
| ValueSome pos-> DemangleGenericTypeNameWithPos pos mangledName
516+
|_-> mangledName
511517

512518
letprivatechopStringTo(s:string)(c:char)=
513519
match s.IndexOf cwith

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp