Skip to content

Issue on finding the function name in type in reflection #7825

@kaizhangNV

Description

@kaizhangNV

Given a shader like this:

public interface IModel<T:IDifferentiable>
{
    public T forward(T x);
}

interface IScalarActivation<T:IDifferentiable> {}

public extension<T:IDifferentiable, Act:IScalarActivation<T>> Act: IModel<T>
{
    public T forward(T x) { return x;}
}

public struct MyStruct<T:IDifferentiable>: IScalarActivation<T> {}

public extension<T:IDifferentiable> MyStruct<T>: IModel<T[2]>
{
    public T[2] forward(T[2] x) { return x;}
}

[shader("compute")]
void computeMain(uint3 tid: SV_DispatchThreadID)
{
}

When we use reflection API findFunctionByNameInType to find the function of name "forward" under the type "MyStruct", it will only find the one defined in the extension of MyStruct, aka.

public extension<T:IDifferentiable> MyStruct<T>: IModel<T[2]>
{
    public T[2] forward(T[2] x) { return x;}
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions