Skip to content

Fix How we Reference Generic Types in Doc-Comments#4585

Merged
InsertCreativityHere merged 4 commits into
icerpc:mainfrom
InsertCreativityHere:correctly-write-generics-in-comments
May 7, 2026
Merged

Fix How we Reference Generic Types in Doc-Comments#4585
InsertCreativityHere merged 4 commits into
icerpc:mainfrom
InsertCreativityHere:correctly-write-generics-in-comments

Conversation

@InsertCreativityHere
Copy link
Copy Markdown
Member

@InsertCreativityHere InsertCreativityHere commented May 7, 2026

We should use code-formatting for the places which are actually code, instead of leaving them in plain-text formatting.

Old, and no longer relevant:

The correct syntax is to use '{' and '}' instead of '<' and '>', even if they're XML escaped to '>' or '<'.
As we figured out after some research on #4566.

The correct syntax is to use '{' and '}' instead of '<' and '>', even if
they're XML escaped to '&gt;' or '&lt;'.
Comment thread src/ZeroC.Slice.Generator/FieldExtensions.cs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates internal XML doc-comments to use the {} generic-parameter syntax rather than <> (even when XML-escaped), based on the findings from #4566/#4494 about cref formatting.

Changes:

  • Updated doc-comment text in the Slice generators to reference generic types using {}.
  • Adjusted summaries for parameter/return type mapping helpers to align with the new generic-type reference style.
  • Updated a doc-comment in FieldExtensions describing ReadOnlyMemory mapping.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/ZeroC.Slice.Generator/TypeRefExtensions.cs Updates summaries describing incoming/outgoing parameter type mappings for sequences/dictionaries.
src/ZeroC.Slice.Generator/FieldExtensions.cs Updates summary describing ReadOnlyMemory<T> mapping for outgoing parameters.
src/IceRpc.Slice.Generator/OperationExtensions.cs Updates summary describing operation return types (Task, Task<T>, tuple).

Comment thread src/ZeroC.Slice.Generator/TypeRefExtensions.cs Outdated
Comment thread src/ZeroC.Slice.Generator/TypeRefExtensions.cs Outdated
Comment thread src/ZeroC.Slice.Generator/FieldExtensions.cs Outdated
Comment thread src/IceRpc.Slice.Generator/OperationExtensions.cs Outdated
}

/// <summary>Returns the C# return type for an operation (Task, Task&lt;T&gt;, or Task&lt;tuple&gt;).
/// <summary>Returns the C# return type for an operation (Task, Task{T}, or Task{tuple}).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the code tag for those.

Comment thread src/ZeroC.Slice.Generator/FieldExtensions.cs Outdated

/// <summary>Returns the C# type string for an incoming parameter (decode target). Sequences map to arrays,
/// dictionaries map to Dictionary&lt;K,V&gt;. Respects cs::type attribute.</summary>
/// dictionaries map to Dictionary{K,V};. Respects cs::type attribute.</summary>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dictionary and cs::type should be render inside code tag IMO

/// primitives map to ReadOnlyMemory&lt;T&gt;, other sequences to IEnumerable&lt;T&gt;, dictionaries to
/// IEnumerable&lt;KeyValuePair&lt;K,V&gt;&gt;.</summary>
/// primitives map to ReadOnlyMemory{T}, other sequences to IEnumerable{T}, dictionaries to
/// IEnumerable{KeyValuePair{K,V}}.</summary>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto use code tag for the code bits

@InsertCreativityHere
Copy link
Copy Markdown
Member Author

Okay, I wrapped all of the generics in code-tags, instead of using the curly-brace syntax.
You're right, we're really showing the code-snippets that these map to, we have no interest in linking to the type itself.

/// <value>A pool of memory blocks used for buffer management. Defaults to <see cref="MemoryPool{T}.Shared"
/// />.</value>
/// <remarks>The built-in TCP transport requires the pool to return array-backed memory blocks, because its
/// multi-segment write path uses <see cref="System.Net.Sockets.Socket.SendAsync(System.Collections.Generic.IList{ArraySegment{byte}},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While looking through everywhere we reference a generic type with curly braces (to catch any others that should use code-formatting) I came across a couple places which the IDE said were over-qualified.

@InsertCreativityHere InsertCreativityHere merged commit fd93b72 into icerpc:main May 7, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants