Skip to content

Commit decaa24

Browse files
author
Michael Jin
authored
[.NET] Compound Type Constraint Does Not Render (#545)
1 parent 83d0e18 commit decaa24

File tree

31 files changed

+1443
-6
lines changed

31 files changed

+1443
-6
lines changed

mdoc/Mono.Documentation/Updater/Formatters/CSharpFullMemberFormatter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,11 @@ private StringBuilder AppendConstraints (StringBuilder buf, IList<GenericParamet
316316
for (int i = 1; i < constraints.Count; ++i)
317317
buf.Append (", ").Append (GetTypeName (constraints[i]));
318318
#endif
319+
319320
}
320321
if (isnew && !isvt)
321322
{
322-
if (comma)
323+
if (comma || constraints.Count > 0)
323324
buf.Append (", ");
324325
buf.Append ("new()");
325326
}
@@ -768,4 +769,4 @@ protected override string GetEventDeclaration (EventDefinition e)
768769
return buf.ToString ();
769770
}
770771
}
771-
}
772+
}

mdoc/Test/DocTest-v1.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,13 @@ public interface IFoo<T> {
649649
T Method <U> (T t, U u);
650650
}
651651

652+
/// <typeparam name="NGparam">Non-generic param</typeparam>
653+
/// <remarks><c>T:Mono.DocTest.CompoundConstraints</c>.</remarks>
654+
public class CompoundConstraints<NGparam> where NGparam : class, new()
655+
{
656+
public static void CompoundConstraintClass<param> () where param : class, new() { }
657+
}
658+
652659
/// <typeparam name="A">Ako generic param</typeparam>
653660
/// <typeparam name="B">Bko generic param</typeparam>
654661
/// <remarks><c>T:Mono.DocTest.MyList`2</c>.</remarks>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<Type Name="CompoundConstraints&lt;NGparam&gt;" FullName="Mono.DocTest.Generic.CompoundConstraints&lt;NGparam&gt;">
2+
<TypeSignature Language="C#" Value="public class CompoundConstraints&lt;NGparam&gt; where NGparam : class, new()" />
3+
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompoundConstraints`1&lt;class .ctor NGparam&gt; extends System.Object" />
4+
<AssemblyInfo>
5+
<AssemblyName>DocTest</AssemblyName>
6+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
7+
</AssemblyInfo>
8+
<TypeParameters>
9+
<TypeParameter Name="NGparam">
10+
<Constraints>
11+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
12+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
13+
</Constraints>
14+
</TypeParameter>
15+
</TypeParameters>
16+
<Base>
17+
<BaseTypeName>System.Object</BaseTypeName>
18+
</Base>
19+
<Interfaces />
20+
<Docs>
21+
<typeparam name="NGparam">To be added.</typeparam>
22+
<summary>To be added.</summary>
23+
<remarks>To be added.</remarks>
24+
</Docs>
25+
<Members>
26+
<Member MemberName=".ctor">
27+
<MemberSignature Language="C#" Value="public CompoundConstraints ();" />
28+
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
29+
<MemberSignature Language="C++ CX" Value="public:&#xA; CompoundConstraints();" />
30+
<MemberType>Constructor</MemberType>
31+
<AssemblyInfo>
32+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
33+
</AssemblyInfo>
34+
<Parameters />
35+
<Docs>
36+
<summary>To be added.</summary>
37+
<remarks>To be added.</remarks>
38+
</Docs>
39+
</Member>
40+
<Member MemberName="CompoundConstraintClass&lt;param&gt;">
41+
<MemberSignature Language="C#" Value="public static void CompoundConstraintClass&lt;param&gt; () where param : class, new();" />
42+
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void CompoundConstraintClass&lt;class .ctor param&gt;() cil managed" />
43+
<MemberSignature Language="C++ CX" Value="public:&#xA;generic &lt;typename param&gt;&#xA; where param : class, gcnew() static void CompoundConstraintClass();" />
44+
<MemberType>Method</MemberType>
45+
<AssemblyInfo>
46+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
47+
</AssemblyInfo>
48+
<ReturnValue>
49+
<ReturnType>System.Void</ReturnType>
50+
</ReturnValue>
51+
<TypeParameters>
52+
<TypeParameter Name="param">
53+
<Constraints>
54+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
55+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
56+
</Constraints>
57+
</TypeParameter>
58+
</TypeParameters>
59+
<Parameters />
60+
<Docs>
61+
<typeparam name="param">To be added.</typeparam>
62+
<summary>To be added.</summary>
63+
<remarks>To be added.</remarks>
64+
</Docs>
65+
</Member>
66+
</Members>
67+
</Type>

mdoc/Test/en.expected-cppcx2/index.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<Type Name="Widget+NestedClass+Double+Triple+Quadruple" Kind="Class" />
3636
</Namespace>
3737
<Namespace Name="Mono.DocTest.Generic">
38+
<Type Name="CompoundConstraints`1" DisplayName="CompoundConstraints&lt;NGparam&gt;" Kind="Class" />
3839
<Type Name="Extensions" Kind="Class" />
3940
<Type Name="Func`2" DisplayName="Func&lt;TArg,TRet&gt;" Kind="Delegate" />
4041
<Type Name="GenericBase`1" DisplayName="GenericBase&lt;U&gt;" Kind="Class" />
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<Type Name="CompoundConstraints&lt;NGparam&gt;" FullName="Mono.DocTest.Generic.CompoundConstraints&lt;NGparam&gt;">
2+
<TypeSignature Language="C#" Value="public class CompoundConstraints&lt;NGparam&gt; where NGparam : class, new()" />
3+
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompoundConstraints`1&lt;class .ctor NGparam&gt; extends System.Object" />
4+
<AssemblyInfo>
5+
<AssemblyName>DocTest</AssemblyName>
6+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
7+
</AssemblyInfo>
8+
<TypeParameters>
9+
<TypeParameter Name="NGparam">
10+
<Constraints>
11+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
12+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
13+
</Constraints>
14+
</TypeParameter>
15+
</TypeParameters>
16+
<Base>
17+
<BaseTypeName>System.Object</BaseTypeName>
18+
</Base>
19+
<Interfaces />
20+
<Docs>
21+
<typeparam name="NGparam">To be added.</typeparam>
22+
<summary>To be added.</summary>
23+
<remarks>To be added.</remarks>
24+
</Docs>
25+
<Members>
26+
<Member MemberName=".ctor">
27+
<MemberSignature Language="C#" Value="public CompoundConstraints ();" />
28+
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
29+
<MemberSignature Language="C++ WINRT" Value=" CompoundConstraints();" />
30+
<MemberType>Constructor</MemberType>
31+
<AssemblyInfo>
32+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
33+
</AssemblyInfo>
34+
<Parameters />
35+
<Docs>
36+
<summary>To be added.</summary>
37+
<remarks>To be added.</remarks>
38+
</Docs>
39+
</Member>
40+
<Member MemberName="CompoundConstraintClass&lt;param&gt;">
41+
<MemberSignature Language="C#" Value="public static void CompoundConstraintClass&lt;param&gt; () where param : class, new();" />
42+
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void CompoundConstraintClass&lt;class .ctor param&gt;() cil managed" />
43+
<MemberSignature Language="C++ WINRT" Value="template &lt;typename param&gt;&#xA; where param : class, gcnew() static void CompoundConstraintClass();" />
44+
<MemberType>Method</MemberType>
45+
<AssemblyInfo>
46+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
47+
</AssemblyInfo>
48+
<ReturnValue>
49+
<ReturnType>System.Void</ReturnType>
50+
</ReturnValue>
51+
<TypeParameters>
52+
<TypeParameter Name="param">
53+
<Constraints>
54+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
55+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
56+
</Constraints>
57+
</TypeParameter>
58+
</TypeParameters>
59+
<Parameters />
60+
<Docs>
61+
<typeparam name="param">To be added.</typeparam>
62+
<summary>To be added.</summary>
63+
<remarks>To be added.</remarks>
64+
</Docs>
65+
</Member>
66+
</Members>
67+
</Type>

mdoc/Test/en.expected-cppwinrt2/index.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<Type Name="Widget+NestedClass+Double+Triple+Quadruple" Kind="Class" />
3636
</Namespace>
3737
<Namespace Name="Mono.DocTest.Generic">
38+
<Type Name="CompoundConstraints`1" DisplayName="CompoundConstraints&lt;NGparam&gt;" Kind="Class" />
3839
<Type Name="Extensions" Kind="Class" />
3940
<Type Name="Func`2" DisplayName="Func&lt;TArg,TRet&gt;" Kind="Delegate" />
4041
<Type Name="GenericBase`1" DisplayName="GenericBase&lt;U&gt;" Kind="Class" />

mdoc/Test/en.expected-fx-import/FrameworksIndex/one.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@
109109
</Type>
110110
</Namespace>
111111
<Namespace Name="Mono.DocTest.Generic">
112+
<Type Name="Mono.DocTest.Generic.CompoundConstraints`1" Id="T:Mono.DocTest.Generic.CompoundConstraints`1">
113+
<Member Id="M:Mono.DocTest.Generic.CompoundConstraints`1.#ctor" />
114+
<Member Id="M:Mono.DocTest.Generic.CompoundConstraints`1.CompoundConstraintClass``1" />
115+
</Type>
112116
<Type Name="Mono.DocTest.Generic.Extensions" Id="T:Mono.DocTest.Generic.Extensions">
113117
<Member Id="M:Mono.DocTest.Generic.Extensions.Bar``1(Mono.DocTest.Generic.IFoo{``0},System.String)" />
114118
<Member Id="M:Mono.DocTest.Generic.Extensions.ForEach``1(System.Collections.Generic.IEnumerable{``0},System.Action{``0})" />
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<Type Name="CompoundConstraints&lt;NGparam&gt;" FullName="Mono.DocTest.Generic.CompoundConstraints&lt;NGparam&gt;">
2+
<TypeSignature Language="C#" Value="public class CompoundConstraints&lt;NGparam&gt; where NGparam : class, new()" />
3+
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompoundConstraints`1&lt;class .ctor NGparam&gt; extends System.Object" />
4+
<AssemblyInfo>
5+
<AssemblyName>DocTest</AssemblyName>
6+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
7+
</AssemblyInfo>
8+
<TypeParameters>
9+
<TypeParameter Name="NGparam">
10+
<Constraints>
11+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
12+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
13+
</Constraints>
14+
</TypeParameter>
15+
</TypeParameters>
16+
<Base>
17+
<BaseTypeName>System.Object</BaseTypeName>
18+
</Base>
19+
<Interfaces />
20+
<Docs>
21+
<typeparam name="NGparam">Non-generic param</typeparam>
22+
<summary>To be added.</summary>
23+
<remarks>
24+
<c>T:Mono.DocTest.CompoundConstraints</c>.</remarks>
25+
</Docs>
26+
<Members>
27+
<Member MemberName=".ctor">
28+
<MemberSignature Language="C#" Value="public CompoundConstraints ();" />
29+
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
30+
<MemberType>Constructor</MemberType>
31+
<AssemblyInfo>
32+
<AssemblyName>DocTest</AssemblyName>
33+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
34+
</AssemblyInfo>
35+
<Parameters />
36+
<Docs>
37+
<summary>To be added.</summary>
38+
<remarks>To be added.</remarks>
39+
</Docs>
40+
</Member>
41+
<Member MemberName="CompoundConstraintClass&lt;param&gt;">
42+
<MemberSignature Language="C#" Value="public static void CompoundConstraintClass&lt;param&gt; () where param : class, new();" />
43+
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void CompoundConstraintClass&lt;class .ctor param&gt;() cil managed" />
44+
<MemberType>Method</MemberType>
45+
<AssemblyInfo>
46+
<AssemblyName>DocTest</AssemblyName>
47+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
48+
</AssemblyInfo>
49+
<ReturnValue>
50+
<ReturnType>System.Void</ReturnType>
51+
</ReturnValue>
52+
<TypeParameters>
53+
<TypeParameter Name="param">
54+
<Constraints>
55+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
56+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
57+
</Constraints>
58+
</TypeParameter>
59+
</TypeParameters>
60+
<Parameters />
61+
<Docs>
62+
<typeparam name="param">To be added.</typeparam>
63+
<summary>To be added.</summary>
64+
<remarks>To be added.</remarks>
65+
</Docs>
66+
</Member>
67+
</Members>
68+
</Type>

mdoc/Test/en.expected-fx-import/index.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<Type Name="Widget+NestedClass+Double+Triple+Quadruple" Kind="Class" />
5656
</Namespace>
5757
<Namespace Name="Mono.DocTest.Generic">
58+
<Type Name="CompoundConstraints`1" DisplayName="CompoundConstraints&lt;NGparam&gt;" Kind="Class" />
5859
<Type Name="Extensions" Kind="Class" />
5960
<Type Name="Func`2" DisplayName="Func&lt;TArg,TRet&gt;" Kind="Delegate" />
6061
<Type Name="GenericBase`1" DisplayName="GenericBase&lt;U&gt;" Kind="Class" />
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<Type Name="CompoundConstraints&lt;NGparam&gt;" FullName="Mono.DocTest.Generic.CompoundConstraints&lt;NGparam&gt;">
2+
<TypeSignature Language="C#" Value="public class CompoundConstraints&lt;NGparam&gt; where NGparam : class, new()" />
3+
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CompoundConstraints`1&lt;class .ctor NGparam&gt; extends System.Object" />
4+
<AssemblyInfo>
5+
<AssemblyName>DocTest</AssemblyName>
6+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
7+
</AssemblyInfo>
8+
<TypeParameters>
9+
<TypeParameter Name="NGparam">
10+
<Constraints>
11+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
12+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
13+
</Constraints>
14+
</TypeParameter>
15+
</TypeParameters>
16+
<Base>
17+
<BaseTypeName>System.Object</BaseTypeName>
18+
</Base>
19+
<Interfaces />
20+
<Docs>
21+
<typeparam name="NGparam">To be added.</typeparam>
22+
<summary>To be added.</summary>
23+
<remarks>To be added.</remarks>
24+
</Docs>
25+
<Members>
26+
<Member MemberName=".ctor">
27+
<MemberSignature Language="C#" Value="public CompoundConstraints ();" />
28+
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
29+
<MemberType>Constructor</MemberType>
30+
<AssemblyInfo>
31+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
32+
</AssemblyInfo>
33+
<Parameters />
34+
<Docs>
35+
<summary>To be added.</summary>
36+
<remarks>To be added.</remarks>
37+
</Docs>
38+
</Member>
39+
<Member MemberName="CompoundConstraintClass&lt;param&gt;">
40+
<MemberSignature Language="C#" Value="public static void CompoundConstraintClass&lt;param&gt; () where param : class, new();" />
41+
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void CompoundConstraintClass&lt;class .ctor param&gt;() cil managed" />
42+
<MemberType>Method</MemberType>
43+
<AssemblyInfo>
44+
<AssemblyVersion>0.0.0.0</AssemblyVersion>
45+
</AssemblyInfo>
46+
<ReturnValue>
47+
<ReturnType>System.Void</ReturnType>
48+
</ReturnValue>
49+
<TypeParameters>
50+
<TypeParameter Name="param">
51+
<Constraints>
52+
<ParameterAttribute>DefaultConstructorConstraint</ParameterAttribute>
53+
<ParameterAttribute>ReferenceTypeConstraint</ParameterAttribute>
54+
</Constraints>
55+
</TypeParameter>
56+
</TypeParameters>
57+
<Parameters />
58+
<Docs>
59+
<typeparam name="param">To be added.</typeparam>
60+
<summary>To be added.</summary>
61+
<remarks>To be added.</remarks>
62+
</Docs>
63+
</Member>
64+
</Members>
65+
</Type>

0 commit comments

Comments
 (0)