ItsDeltin / Overwatch-Script-To-Workshop

Converts scripts to Overwatch workshops.
207 stars 24 forks source link

Generic class with a method that calls another method throws an exception #476

Closed PatrickSzela closed 2 months ago

PatrickSzela commented 4 months ago

Generic classes which have a method that calls another method throw an exception:

An exception was thrown while translating to workshop.
System.Exception: ClassWorkshopRelation is not created for type Test<T>
   at Deltin.Deltinteger.Parse.ClassWorkshopInitializerComponent.RelationFromClassType(ClassType type) in /home/runner/work/Overwatch-Script-To-Workshop/Overwatch-Script-To-Workshop/Deltinteger/Deltinteger/Parse/Workshop/ClassWorkshopInitializer.cs:line 82
[...rest has been trimmed]

This snippet doesn't compile:

rule: 'My Rule'
{
  Test<Number> t = new Test<Number>();
  t.Log();
}

class Test<T> {
  public void LogInner() {}

  public void Log() {
    LogInner();
  }
}

But this compiles just fine:

rule: 'My Rule'
{
  Test t = new Test();
  t.Log();
}

class Test {
  public void LogInner() {}

  public void Log() {
    LogInner();
  }
}

This wasn't an issue in one of the master builds sometime before v2.7 release, but according to my testing every >=v2.7 build now throws this exception