SuperNodes Generated with Explicit Interface Definitions
When using explicit interface definitions like below, the SuperNode generated fails to generate correctly for the following case.
For example:
The given interface.
public interface IHaveAutoload<T> {
T Instance { get; }
}
The given class.
[GlobalClass, SuperNode(typeof(Dependent))]
public partial class Component: Node2D, IHaveAutoload<SignalAutoload>, IHaveAutoload<AnotherAutoload> {
protected AnotherAutoload anotherAutoload = null!;
AnotherAutoload IHaveAutoload<AnotherAutoload>.Instance => this.anotherAutoload;
protected SignalAutoload signalAutoload = null!;
SignalAutoload IHaveAutoload<SignalAutoload>.Instance => this.signalAutoload;
public override void _Ready() {
this.anotherAutoload = this.GetNode<AnotherAutoload>(
"/root/AnotherAutoload"
);
this.signalAutoload = this.GetNode<SignalAutoload>(
"/root/SignalAutoload"
);
}
}
Produces inside of the generated SuperNode:
public static TResult ReceiveScriptPropertyOrFieldType<TResult>(
string scriptProperty, ITypeReceiver<TResult> receiver
) {
switch (scriptProperty) {
case "Instance":
return receiver.Receive<NameSpaceOfAutoloadClass>();
case "Instance":
return receiver.Receive<NameSpaceOfAutoloadClass>();
}
}
public dynamic? GetScriptPropertyOrField(string scriptProperty) {
switch (scriptProperty) {
case "Instance":
return (()this).Instance;
case "Instance":
return (()this).Instance;
}
}
After thinking about this a little more, I poked around how the IProvide<> interface worked.
If I switch over to an interface like:
public interface IHaveAutoload<T> {
T Instance();
}
Things appear to build correctly. I think it is because it's a method now and not an Auto-Property but I'm not sure.
Ah, thank you for filing this issue. Seems the method can be used as a workaround in the meantime. I have some ideas on how this might be fixed, will try when I get a chance.