-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
base: main
Are you sure you want to change the base?
Conversation
Tagging subscribers to this area: @dotnet/area-system-numerics-tensors |
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 | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
This resolves #112781