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:
parent
3280238ade
commit
299918d641
2 changed files with 48 additions and 2 deletions
|
@ -16317,8 +16317,6 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
|
|||
|
||||
if (checkMethod->mExplicitInterface != NULL)
|
||||
continue;
|
||||
if (checkMethod->mIsOverride)
|
||||
continue;
|
||||
|
||||
auto autoComplete = GetAutoComplete();
|
||||
bool wasCapturingMethodMatchInfo = false;
|
||||
|
|
48
IDEHelper/Tests/src/Indexers.bf
Normal file
48
IDEHelper/Tests/src/Indexers.bf
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue