Closed byakuren-hijiri closed 1 day ago
The typechecker allows to define the following function within a trait:
trait t { abstract get fun _k(): Int; }
The problem is that it cannot be used in the contract inheriting the trait:
contract TestContract with t { override get fun _k(): Int { return 0; } }
Error: contract.tact:8:3: Overridden function "_k" can not be a getter
contract.tact:8:3: Overridden function "_k" can not be a getter
Without override:
override
contract TestContract with t { get fun _k(): Int { return 0; } }
Error: contract.tact:7:1: Function "_k" already exist in "TestContract"
contract.tact:7:1: Function "_k" already exist in "TestContract"
My suggestion is to either allow to override abstract getters in contracts, or to forbid their definitions in traits in the typechecker.
The typechecker allows to define the following function within a trait:
The problem is that it cannot be used in the contract inheriting the trait:
Error:
contract.tact:8:3: Overridden function "_k" can not be a getter
Without
override
:Error:
contract.tact:7:1: Function "_k" already exist in "TestContract"
My suggestion is to either allow to override abstract getters in contracts, or to forbid their definitions in traits in the typechecker.