Type mismatch, cannot find operator to evaluate "Int32" = "NodeLevel"

Given this :-

type NodeLevel = (Hub=0,LocationType=1,Location=2);

In the following, lTreeNode.Level is an Integer.
This fails to compile :-

case lTreeNode.Level = NodeLevel.Hub of
	false : exit;
end;

Error (E64) Type mismatch, cannot find operator to evaluate “Int32” = “NodeLevel”

This compiles and works :-

case lTreeNode.Level of 
	NodeLevel.Hub : ; 
else  exit;
end;

Surely both variants are having to compare Int32 values or am I being dim and missing something simple ?

Good question. yeah, id say either rebirth should require a case or neither. @ck, whats your take here?

Hrmm. Neither should work no. Enums shouldn’t strongly be compatible with integers (it would need a cast to the exact type). I’ll log.

1 Like

Thanks, logged as bugs://83577

bugs://83577 got closed with status fixed.