Skip to content

Expose the extension operators for Tensor, TensorSpan, and ROTensorSpan #117997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

tannergooding
Copy link
Member

This resolves #112781

@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Jul 23, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics-tensors
See info in area-owners.md if you want to be subscribed.

Comment on lines 109 to 124
try
{
TrimDataFlowAnalysis trimDataFlowAnalysis = new(context, dataFlowAnalyzerContext, operationBlock);
trimDataFlowAnalysis.InterproceduralAnalyze();
trimDataFlowAnalysis.ReportDiagnostics(context.ReportDiagnostic);
foreach (var operationBlock in context.OperationBlocks)
{
TrimDataFlowAnalysis trimDataFlowAnalysis = new(context, dataFlowAnalyzerContext, operationBlock);
trimDataFlowAnalysis.InterproceduralAnalyze();
trimDataFlowAnalysis.ReportDiagnostics(context.ReportDiagnostic);
}
}
catch (InvalidCastException)
{
// Newer language features may produce NonErrorNamedTypeSymbol
// which will fail to cast to a given target type. Catch and
// ignore the failure in this scenario since it otherwise blocks
// the analyzer
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@dotnet/illink this was being hit for the new user-defined compound assignment operators.

I wasn't able to get a stack trace or figure out how to get this to debug, so I couldn't determine what wasn't handling the scenario correctly. But something in the InterproceduralAnalyze() call gets a NonErrorNamedTypeSymbol and then tries to cast it to an IMethodSymbol, which fails and brings down the whole analyzer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this might be from one of the (IMethodSymbol)parameter.ContainingSymbol casts; since extension(T name) { } is now possible and not a method.

… that are not on methods so the analyzer doesn't throw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Numerics.Tensors linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: Tensor Operators
1 participant