I thought I'd fixed this just after M6, but the JUnit still has the
Enumeration test commented out with a FIXME.
I'm just about to commit some major fixes for the editor
resynchronization after errors have been fixed, then I'll have a look.
On 20/04/2011 14:44, Joern wrote:
> How do I retrieve all literals from an enum?
> Until Indigo it has been possible to use something like
> MyEnum.allInstances(). This does not evaluate in Indigo (Interactive
> Xtext OCL Console).
> Thanks in advance & best regards
no promises. I'll add the above to my test cases.
The underlying problem is that the specification has never defined type
expressions clearly; '4.oclAsType(Real)' is not syntactically valid!
Implementations have always been pragmatic. The new evaluator is too,
and the pragmatism falls over on a couple of FIXMEs. allInstances() is
unusual in that it is a dynamic static operation; static in that it
applies to a class, dynamic in that it varies for derived classes.
Modeling this as the pivot model does requires extra clarity that may
eventually make it into the specification.
Should be fixed in M7.
On 20/04/2011 15:08, Joern wrote:
> Thanks for your quick reply.
> Unfortunately the model validation shows the same behaviour so the
> models do not validate any more. Are there any alternatives?
> Best regards,
I've no idea why oclType() does not exist. You'll have to provide
detailed information on versions and files. AFAIK oclType() exists in
all Eclipse OCL versions but with rather suspect utility in most.
I've just committed changes that resolve a pleasing number of FIXMEs in
regard to TypeValues by introducing a templated Classifier<T> so that
the known type is propagated as e.g. Classifier<CollectionKind>. This
gets rid of most of the pragmatic code; both oclType() and
allInstances() are now model rather than manually-defined.
On 20/04/2011 16:20, Joern wrote:
> Hi Ed,
> Thanks for the answer.
> I tried your proposals - but the operation oclType() seems not to
> exist. Neither Enum::Literal.oclType() nor Enum.oclType() does evaluate.
> In the spec I only found a refernce to "OclType" as "the singleton
> instance of TypeType" ...
> But another workaround would be welcome :)
> Best regards,