Skip to content

Compiler code emit problem with overriding PROPERTYs implementing an interface #2028

Description

@cpyrgas

Code produces this runtime exception:

System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'ImplementClass'

I think the problem is that the parent properties are not declared as VIRTUAL. In any case, the compiler should either report an error (I suspect that's the best option), or emit appropriate code, so that the problem is not raised and found at runtime only.

// any dialect, no compiler options used
INTERFACE ITest
	PROPERTY TestProperty1 AS INT AUTO
	PROPERTY TestProperty2 AS INT AUTO
END INTERFACE

CLASS Parent IMPLEMENTS ITest
	PROPERTY TestProperty1 AS INT AUTO
	PROPERTY TestProperty2 AS INT AUTO
END CLASS

CLASS ImplementClass INHERIT Parent // IMPLEMENTS ITest
	OVERRIDE PROPERTY TestProperty1 AS INT AUTO
	VIRTUAL OVERRIDE PROPERTY TestProperty2 AS INT AUTO
END CLASS

FUNCTION Start() AS VOID
	ImplementClass{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions