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

Commit9179d77

Browse files
committed
Fix fordotnet#9 - XML doc comments on F# record type fields do not appear when accessing in C#
F# record fields are exposed as properties, and therefore need the "P:" prefix in their XML doc markup. They were incorrectly being given the "F:" prefix. (changeset 1280439)
1 parent94c69c5 commit9179d77

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

‎src/fsharp/fsc.fs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,15 +602,21 @@ module XmlDocWriter =
602602
letg= tcGlobals
603603
letdoValSig ptext(v:Val)=if(hasDoc v.XmlDoc)then v.XmlDocSig<- XmlDocSigOfVal g ptext v
604604
letdoTyconSig ptext(tc:Tycon)=
605-
if(hasDoc tc.XmlDoc)then tc.XmlDocSig<- XmlDocSigOfTycon ptext tc
605+
if(hasDoc tc.XmlDoc)then tc.XmlDocSig<- XmlDocSigOfTycon[ptext; tc.CompiledName]
606606
for vrefin tc.MembersOfFSharpTyconSorteddo
607607
doValSig ptext vref.Deref
608608
for ucin tc.UnionCasesAsListdo
609-
if(hasDoc uc.XmlDoc)then uc.XmlDocSig<- XmlDocSigOfUnionCase ptextuc.Id.idText tc.CompiledName
609+
if(hasDoc uc.XmlDoc)then uc.XmlDocSig<- XmlDocSigOfUnionCase[ptext; tc.CompiledName;uc.Id.idText]
610610
for rfin tc.AllFieldsAsListdo
611-
if(hasDoc rf.XmlDoc)then rf.XmlDocSig<- XmlDocSigOfField ptext rf.Id.idText tc.CompiledName
611+
if(hasDoc rf.XmlDoc)then
612+
rf.XmlDocSig<-
613+
if tc.IsRecordTycon&&(not rf.IsStatic)then
614+
// represents a record field, which is exposed as a property
615+
XmlDocSigOfProperty[ptext; tc.CompiledName; rf.Id.idText]
616+
else
617+
XmlDocSigOfField[ptext; tc.CompiledName; rf.Id.idText]
612618

613-
letdoModuleMemberSig path(m:ModuleOrNamespace)= m.XmlDocSig<- XmlDocSigOfSubModul path
619+
letdoModuleMemberSig path(m:ModuleOrNamespace)= m.XmlDocSig<- XmlDocSigOfSubModul[path]
614620
(* moduleSpec - recurses*)
615621
let recdoModuleSig path(mspec:ModuleOrNamespace)=
616622
letmtype= mspec.ModuleOrNamespaceType

‎src/fsharp/tastops.fs‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6778,23 +6778,20 @@ let XmlDocSigOfVal g path (v:Val) =
67786778
letgenArity=if arity=0then""else sprintf"``%d" arity
67796779
prefix+ prependPath path name+ genArity+ args
67806780

6781-
letXmlDocSigOfUnionCase path case typeName=
6782-
// Would like to use "U:", but ParseMemberSignature only accepts C# signatures
6783-
letprefix="T:"
6784-
letpath= prependPath path typeName
6785-
prefix+ prependPath path case
6786-
6787-
letXmlDocSigOfField path name compiledName=
6788-
letprefix="F:"
6789-
letpath= prependPath path compiledName
6790-
prefix+ prependPath path name
6781+
letBuildXmlDocSig prefix paths= prefix+ List.fold prependPath"" paths
67916782

6792-
letXmlDocSigOfTycon path(tc:Tycon)="T:"+ prependPath path tc.CompiledName
6793-
letXmlDocSigOfSubModul path="T:"+ path
6783+
letXmlDocSigOfUnionCase= BuildXmlDocSig"T:"// Would like to use "U:", but ParseMemberSignature only accepts C# signatures
67946784

6795-
letXmlDocSigOfEntity(eref:EntityRef)=
6796-
XmlDocSigOfTycon(buildAccessPath eref.CompilationPathOpt) eref.Deref
6785+
letXmlDocSigOfField= BuildXmlDocSig"F:"
6786+
6787+
letXmlDocSigOfProperty= BuildXmlDocSig"P:"
67976788

6789+
letXmlDocSigOfTycon= BuildXmlDocSig"T:"
6790+
6791+
letXmlDocSigOfSubModul= BuildXmlDocSig"T:"
6792+
6793+
letXmlDocSigOfEntity(eref:EntityRef)=
6794+
XmlDocSigOfTycon[(buildAccessPath eref.CompilationPathOpt); eref.Deref.CompiledName]
67986795

67996796
//--------------------------------------------------------------------------
68006797
// Some unions have null as representations

‎src/fsharp/tastops.fsi‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,13 +1255,13 @@ val buildAccessPath : CompilationPath option -> string
12551255

12561256
val XmlDocArgsEnc: TcGlobals-> Typars* Typars-> TType list-> string
12571257
val XmlDocSigOfVal: TcGlobals-> string-> Val-> string
1258-
val XmlDocSigOfUnionCase: string-> string-> string-> string
1259-
val XmlDocSigOfField: string-> string-> string-> string
1260-
val XmlDocSigOfTycon: string-> Tycon-> string
1261-
val XmlDocSigOfSubModul: string-> string
1258+
val XmlDocSigOfUnionCase:(string list-> string)
1259+
val XmlDocSigOfField:(string list-> string)
1260+
val XmlDocSigOfProperty:(string list-> string)
1261+
val XmlDocSigOfTycon:(string list-> string)
1262+
val XmlDocSigOfSubModul:(string list-> string)
12621263
val XmlDocSigOfEntity: EntityRef-> string
12631264

1264-
12651265
//---------------------------------------------------------------------------
12661266
// Resolve static optimizations
12671267
//-------------------------------------------------------------------------

‎src/fsharp/vs/ServiceDeclarations.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ module internal ItemDescriptionsImpl =
286286
| None-> XmlCommentNone
287287
| Some ccuFileName->
288288
if rfinfo.RecdField.XmlDocSig=""then
289-
rfinfo.RecdField.XmlDocSig<-XmlDocSigOfField"" rfinfo.Nametcref.CompiledRepresentationForNamedType.FullName
289+
rfinfo.RecdField.XmlDocSig<-XmlDocSigOfProperty[tcref.CompiledRepresentationForNamedType.FullName; rfinfo.Name]
290290
XmlCommentSignature(ccuFileName, rfinfo.RecdField.XmlDocSig)
291291

292292
letGetXmlDocSigOfUnionCaseInfo(ucinfo:UnionCaseInfo)=
@@ -295,7 +295,7 @@ module internal ItemDescriptionsImpl =
295295
| None-> XmlCommentNone
296296
| Some ccuFileName->
297297
if ucinfo.UnionCase.XmlDocSig=""then
298-
ucinfo.UnionCase.XmlDocSig<- XmlDocSigOfUnionCase"" ucinfo.Nametcref.CompiledRepresentationForNamedType.FullName
298+
ucinfo.UnionCase.XmlDocSig<- XmlDocSigOfUnionCase[tcref.CompiledRepresentationForNamedType.FullName; ucinfo.Name]
299299
XmlCommentSignature(ccuFileName, ucinfo.UnionCase.XmlDocSig)
300300

301301
letGetXmlDocSigOfMethInfo(infoReader:InfoReader)m(minfo:MethInfo)=

‎tests/fsharpqa/Source/XmlDoc/Basic/xmlDoc004.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ module MyModule =
126126
&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.TestEnum.VALUE2""enumValue2"
127127
&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.TestEnum.VALUE1""enumValue1"
128128
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestEnum""test enum"
129-
&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.TestRecord.MyProperpty""Record string"
129+
&& check xml"P:MyRather.MyDeep.MyNamespace.MyModule.TestRecord.MyProperpty""Record string"
130130
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.TestRecord""testRecord"
131131
&& check xml"M:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.MyGenericClass`1.TestMethod""testClass member nested"
132132
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.MyGenericClass`1""testClass nested"
@@ -136,7 +136,7 @@ module MyModule =
136136
&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestEnum.VALUE2""enumValue2 nested"
137137
&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestEnum.VALUE1""enumValue1 nested"
138138
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestEnum""test enum nested"
139-
&& check xml"F:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestRecord.MyProperpty""Record string nested"
139+
&& check xml"P:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestRecord.MyProperpty""Record string nested"
140140
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule.TestRecord""testRecord nested"
141141
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule.MyNestedModule""nested module"
142142
&& check xml"T:MyRather.MyDeep.MyNamespace.MyModule""testModule"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp