Beef
Beef copied to clipboard
Error when accessing non-abstract base property in derived class
In the code below, there is an error "Abstract base method cannot be invoked" when trying to access the base property F1 in the derived class C3. However, this error should not occur since the base property in class C2 is not abstract.
abstract class C1
{
public abstract int F1
{
get;
set;
}
}
class C2 : C1
{
public override int F1
{
get => 1;
set => Runtime.NotImplemented();
}
}
class C3 : C2
{
public override int F1
{
get => base.F1; // ERROR: Abstract base method cannot be invoked
set => base.F1 = value; // ERROR: Abstract base method cannot be invoked
}
}
Tested with: https://github.com/beefytech/Beef/commit/4c656529556ef2e7f8398be1b6c1d803dea512a6
On latest nightly (https://github.com/beefytech/Beef/commit/ce42dc4fbe5a7387cd81de7379c49f0477d6367d) this is still an issue. Ready-for-testing project: bug.1847.zip
ERROR: Abstract base method 'bug1847.Beta.Count get accessor' cannot be invoked at line 36:14 in r:\bug.1847\src\Program.bf
ERROR: Abstract base method 'bug1847.Beta.Count set accessor' cannot be invoked at line 37:14 in r:\bug.1847\src\Program.bf
Just in case, tested this code in C#. It works, getter returns 1 and setter throws an exception.