P2003

Code

P2003

Message

Enumeration type declaration has duplicated value

This error occurs when an enumeration type declaration has duplicate values.

Example

The following code will generate error P2003:

TYPE
    LogLevel : (CRITICAL, CRITICAL) := CRITICAL;  (* Error: Duplicate value *)
END_TYPE

The enumeration has two values with the same name CRITICAL, which is not allowed.

To fix this error, ensure all enumeration values are unique:

TYPE
    LogLevel : (CRITICAL, WARNING, INFO, DEBUG) := INFO;  (* All values unique *)
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.