Skip to content

linker throws InvalidCastException when encountering extension user-defined compound assignment operators #118025

@tannergooding

Description

@tannergooding

From: #117997 (comment)

Somewhere in trimDataFlowAnalysis.InterproceduralAnalyze();, an InvalidCastException is thrown due to an attempt to cast NonErrorNamedTypeSymbol to IMethodSymbol.

This is encountered at least for a user-defined compound assignment operator extension:

extension<TScalar>(Tensor<TScalar> tensor)
{
    public void operator +=(in ReadOnlyTensorSpan<TScalar> other) => Add(tensor, other, tensor);
    public void operator +=(TScalar other) => Add(tensor, other, tensor);
}

I was not able to get a stack trace and root cause exactly where the cast failure was occurring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzersbug

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions