P2009

Code

P2009

Message

Parent enumeration is not declared

This error occurs when an enumeration type extends from a parent enumeration that has not been declared.

Example

The following code will generate error P2009:

TYPE
    ChildEnum : (VALUE1, VALUE2) EXTENDS UndeclaredParentEnum;  (* Error: Parent enum not declared *)
END_TYPE

The enumeration ChildEnum tries to extend UndeclaredParentEnum which has not been declared.

To fix this error, declare the parent enumeration first:

TYPE
    BaseEnum : (BASE_VALUE1, BASE_VALUE2);
    ChildEnum : (VALUE1, VALUE2) EXTENDS BaseEnum;  (* Correct: Parent enum declared *)
END_TYPE

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.