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

Commita557fc3

Browse files
surbanKevinRansom
authored andcommitted
Fix module name missing in XmlDocSig of value within a module. (dotnet#4719)
* Fix module name missing in XmlDocSig of value within a module.* Add tests for XmlDocSig of modules* Fix 'Test project28 all symbols in signature'
1 parent70e27ac commita557fc3

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

‎src/fsharp/symbols/SymbolHelpers.fs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,14 @@ module internal SymbolHelpers =
499499
letccuFileName= libFileOfEntityRef tcref
500500
letv= vref.Deref
501501
if v.XmlDocSig=""&& v.HasDeclaringEntitythen
502-
v.XmlDocSig<- XmlDocSigOfVal g(buildAccessPath vref.TopValDeclaringEntity.CompilationPathOpt) v
502+
letap= buildAccessPath vref.TopValDeclaringEntity.CompilationPathOpt
503+
letpath=
504+
if vref.TopValDeclaringEntity.IsModulethen
505+
letsep=if ap.Length>0then"."else""
506+
ap+ sep+ vref.TopValDeclaringEntity.CompiledName
507+
else
508+
ap
509+
v.XmlDocSig<- XmlDocSigOfVal g path v
503510
Some(ccuFileName, v.XmlDocSig)
504511

505512
letGetXmlDocSigOfRecdFieldInfo(rfinfo:RecdFieldInfo)=

‎tests/service/ProjectAnalysisTests.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,8 +3968,8 @@ let ``Test project28 all symbols in signature`` () =
39683968
xmlDocSigs
39693969
|> shouldEqual
39703970
[|("FSharpEntity","M","T:M");
3971-
("FSharpMemberOrFunctionOrValue","( |Even|Odd| )","M:|Even|Odd|(System.Int32)");
3972-
("FSharpMemberOrFunctionOrValue","TestNumber","M:TestNumber(System.Int32)");
3971+
("FSharpMemberOrFunctionOrValue","( |Even|Odd| )","M:M.|Even|Odd|(System.Int32)");
3972+
("FSharpMemberOrFunctionOrValue","TestNumber","M:M.TestNumber(System.Int32)");
39733973
("FSharpEntity","DU","T:M.DU");
39743974
("FSharpUnionCase","A","T:M.DU.A");
39753975
("FSharpField","A","T:M.DU.A");

‎tests/service/Symbols.fs‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,49 @@ match "foo" with
5555

5656
getCaseUsages completePatternInput7|> Array.head|> getGroupName|> shouldEqual"|True|False|"
5757
getCaseUsages partialPatternInput7|> Array.head|> getGroupName|> shouldEqual"|String|_|"
58+
59+
60+
moduleXmlDocSig=
61+
62+
[<Test>]
63+
let``XmlDocSig of modules in namespace``()=
64+
letsource="""
65+
namespace Ns1
66+
module Mod1 =
67+
let val1 = 1
68+
module Mod2 =
69+
let func2 () = ()
70+
"""
71+
letfileName,options= mkTestFileAndOptions source[||]
72+
let_,checkResults= parseAndCheckFile fileName source options
73+
74+
letmod1= checkResults.PartialAssemblySignature.FindEntityByPath["Ns1";"Mod1"]|> Option.get
75+
letmod2= checkResults.PartialAssemblySignature.FindEntityByPath["Ns1";"Mod1";"Mod2"]|> Option.get
76+
letmod1val1= mod1.MembersFunctionsAndValues|> Seq.find(fun m-> m.DisplayName="val1")
77+
letmod2func2= mod2.MembersFunctionsAndValues|> Seq.find(fun m-> m.DisplayName="func2")
78+
mod1.XmlDocSig|> shouldEqual"T:Ns1.Mod1"
79+
mod2.XmlDocSig|> shouldEqual"T:Ns1.Mod1.Mod2"
80+
mod1val1.XmlDocSig|> shouldEqual"P:Ns1.Mod1.val1"
81+
mod2func2.XmlDocSig|> shouldEqual"M:Ns1.Mod1.Mod2.func2"
82+
83+
[<Test>]
84+
let``XmlDocSig of modules``()=
85+
letsource="""
86+
module Mod1
87+
let val1 = 1
88+
module Mod2 =
89+
let func2 () = ()
90+
"""
91+
letfileName,options= mkTestFileAndOptions source[||]
92+
let_,checkResults= parseAndCheckFile fileName source options
93+
94+
letmod1= checkResults.PartialAssemblySignature.FindEntityByPath["Mod1"]|> Option.get
95+
letmod2= checkResults.PartialAssemblySignature.FindEntityByPath["Mod1";"Mod2"]|> Option.get
96+
letmod1val1= mod1.MembersFunctionsAndValues|> Seq.find(fun m-> m.DisplayName="val1")
97+
letmod2func2= mod2.MembersFunctionsAndValues|> Seq.find(fun m-> m.DisplayName="func2")
98+
mod1.XmlDocSig|> shouldEqual"T:Mod1"
99+
mod2.XmlDocSig|> shouldEqual"T:Mod1.Mod2"
100+
mod1val1.XmlDocSig|> shouldEqual"P:Mod1.val1"
101+
mod2func2.XmlDocSig|> shouldEqual"M:Mod1.Mod2.func2"
102+
103+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp