1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed virtual indexers

This commit is contained in:
Brian Fiete 2020-05-13 16:28:42 -07:00
parent 3280238ade
commit 299918d641
2 changed files with 48 additions and 2 deletions

View file

@ -16317,8 +16317,6 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
if (checkMethod->mExplicitInterface != NULL)
continue;
if (checkMethod->mIsOverride)
continue;
auto autoComplete = GetAutoComplete();
bool wasCapturingMethodMatchInfo = false;

View file

@ -0,0 +1,48 @@
using System;
namespace Tests
{
class Indexers
{
class ClassA
{
public virtual int this[int index]
{
get
{
return 123;
}
}
}
class ClassB : ClassA
{
public override int this[int index]
{
get
{
return 234;
}
}
}
class ClassC : ClassB
{
}
[Test]
public static void Hey()
{
ClassB cc = scope ClassC();
ClassB cb = cc;
ClassA ca = cb;
int value = cc[0];
Test.Assert(value == 234);
value = cb[0];
Test.Assert(value == 234);
value = ca[0];
Test.Assert(value == 234);
}
}
}