Skip to content

Conversation

@stephentoub
Copy link
Contributor

Closes #1003

Comment on lines +465 to +466
ImmutableArray<string> TypeParameters, ImmutableArray<ParameterInfo> Parameters,
string? MethodDescription, string? ReturnDescription, ImmutableArray<DiagnosticInfo> Diagnostics)
Copy link
Contributor

Choose a reason for hiding this comment

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

Immutable array is likely to hurt equality here. I personally always reuse EquatableArray from @Sergio0694 for this. https://github.com/Sergio0694/ComputeSharp/blob/main/src/ComputeSharp.SourceGeneration/Helpers/EquatableArray%7BT%7D.cs

private readonly record struct DiagnosticInfo(string Id, Location? Location, params object?[] MessageArgs);

/// <summary>Holds extracted XML documentation for a method.</summary>
private sealed record XmlDocumentation(string MethodDescription, string Returns, Dictionary<string, string> Parameters);
Copy link
Contributor

Choose a reason for hiding this comment

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

This Dictionary should still be a problem, isn't it?

private readonly record struct MethodToGenerate(MethodDeclarationSyntax MethodDeclaration, IMethodSymbol MethodSymbol);
private readonly record struct TypeDeclarationInfo(string Name, string TypeKeyword);

private readonly record struct DiagnosticInfo(string Id, Location? Location, params object?[] MessageArgs);
Copy link
Contributor

Choose a reason for hiding this comment

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

This array here is likely to be a problem as well?

// Combine with compilation to get well-known type symbols.
var compilationAndMethods = context.CompilationProvider.Combine(allMethods);
// Report diagnostics.
context.RegisterSourceOutput(allMethods, static (spc, methods) =>
Copy link
Member

Choose a reason for hiding this comment

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

This separation of diagnostic reporting into a separate callback is an interesting approach. I think it might provide a viable workaround for dotnet/runtime#92509. Curious if you've applied this approach elsewhere before, or if there are any drawbacks to it.

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.

Revise XmlToDescriptionGenerator incrementality

3 participants