Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Enumeration arguments in operations
Enumeration arguments in operations [message #573982] Wed, 12 August 2009 17:16
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hello all,

I've defined an operation which takes an enumeration literal as a
parameter. Oddly enough, it doesn't work when I declare it as such. It
does work when I declare that parameter to be of type Any.

For testing, I've defined an Ecore model whose Emfatic source looks like
this:

@namespace(uri="testEnumArgs", prefix="ea")
package EnumArgs;

enum Color {
RED;
BLUE;
}

If I run the following EOL script against an empty model which conforms
to the previous metamodel, the first call works, but the second reports
"Type 'Color' not found":

toggle(Color#RED).println('Color A: ');
brokenToggle(Color#RED).println('Color A: ');

operation toggle(color : Any) {
if (color = Color#RED) {
return Color#BLUE;
} else {
return Color#RED;
}
}

operation brokenToggle(color : Color) {
if (color = Color#RED) {
return Color#BLUE;
} else {
return Color#RED;
}
}

Is this a bug, or am I doing something wrong?

Just in case, I've submitted a bug with a sample project which
reproduces the issue:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=286412

Regards,
Antonio
Previous Topic:[EGL] CrossReferences
Next Topic:Enumeration arguments in operations
Goto Forum:
  


Current Time: Thu Apr 25 23:56:06 GMT 2024

Powered by FUDForum. Page generated in 0.02820 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top