-
Notifications
You must be signed in to change notification settings - Fork 177
Closed
Description
Came across this problem in 0.8. Consider the following:
public class TestCase
{
public static void Run()
{
Four top = new Four();
top.Foo();
}
}
class One
{
public virtual void Foo() {}
}
class Two : One
{
public override void Foo()
{
base.Foo();
}
}
class Three : Two
{
}
class Four : Three
{
}
The base.Foo() method in Two.Foo() compiles to:
ss.base(this, 'foo').call(this);
And in the test case, 'this' is the Four object. However, the logic in ss.base() is such that it returns Two.Foo, so the call() ends up calling itself, resulting in infinite recursion and a call stack overflow.
I've hacked around this in my copy of S# by modifying GenerateMethodExpression to pass the BaseExpression's EvaluatedType.FullGeneratedName as a third parameter to ss.base(), then modifying ss.base() to favor that third parameter as the starting base class in its search for the base method. That's a total stab in the dark, but starting with the base class seems more reasonable than starting with 'this.'
Metadata
Metadata
Assignees
Labels
No labels