-
Notifications
You must be signed in to change notification settings - Fork 329
Open
Labels
Description
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;}
}
Copilot