Closed LebedevRI closed 1 month ago
to_enum(W, 1) in A
to_enum(W, 1) in B
Both of these are incorrect from a type perspective since the first compares where a W
element is part of a set of A
and the latter whether it is part of a set of B
.
Both should have shown an type error, but current work because the definition of in
currently just always converts to int
/set of int
. We will change the definitions to actually perform the correct type checking.
Also, is it intentional that it's possible to to_enum()
where the "enum" is actually a set?
enum A = A(1..2);
set of A: B = { to_enum(A, c) | c in 1..2 };
set of A: C = { to_enum(B, c) | c in 1..2 };
to_enum(W, 1)
isA(W(1))
, the only element ofA
, while the only element ofB
is{B(W(2))}
. It looks like thein
is takes the index of the enumeration elementA(W(1))
within that enumerationA
, and checks that there is an element within enumerationB
with the same index? I'd have hoped it would have compared the actual enumeration values.Perhaps this is working as intended, but the docs really could be a bit more verbose in places...
This is on debian sid: