Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtend2.2] Semantics of "it" with "switch"
[xtend2.2] Semantics of "it" with "switch" [message #763162] Fri, 09 December 2011 09:31 Go to next message
Klaus Birken is currently offline Klaus BirkenFriend
Messages: 4
Registered: November 2011
Junior Member
Hi,

I just upgraded to xtend 2.2 and experience the following (minor) issue.

In my xtend class, I am using the "it" special variable in combination with a switch-to-subclass expression (TBase and TSome are EMF classes and TBase is base class of TSome):
def generate(TBase it) {
   switch (it) {
      TSome:   name + " because " + purpose
      // ...
   }
}


name is an attribute of the base class TBase and works fine. purpose is an attribute of TSome, this gives an error marker Couldn't resolve reference to JvmIdentifiableElement 'purpose'. This can be fixed by explicitly using it.purpose.

I don't know what is intended here, but I guess the behavior changed from 2.1 to 2.2.

Regards,
Klaus
Re: [xtend2.2] Semantics of "it" with "switch" [message #763245 is a reply to message #763162] Fri, 09 December 2011 12:16 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Yes, that's a know bug. But I don't think we have a bugreport yet.

Sven

Am 12/9/11 10:31 AM, schrieb Klaus Birken:
> Hi,
>
> I just upgraded to xtend 2.2 and experience the following (minor) issue.
>
> In my xtend class, I am using the "it" special variable in combination
> with a switch-to-subclass expression (TBase and TSome are EMF classes
> and TBase is base class of TSome):
>
> def generate(TBase it) {
> switch (it) {
> TSome: name + " because " + purpose
> // ...
> }
> }
>
>
> name is an attribute of the base class TBase and works fine. purpose is
> an attribute of TSome, this gives an error marker Couldn't resolve
> reference to JvmIdentifiableElement 'purpose'. This can be fixed by
> explicitly using it.purpose.
>
> I don't know what is intended here, but I guess the behavior changed
> from 2.1 to 2.2.
>
> Regards,
> Klaus
>


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: [xtend2.2] Semantics of "it" with "switch" [message #763250 is a reply to message #763245] Fri, 09 December 2011 12:28 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
The ticket is already here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=365306

Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 09.12.11 13:16, schrieb Sven Efftinge:
> Yes, that's a know bug. But I don't think we have a bugreport yet.
>
> Sven
>
> Am 12/9/11 10:31 AM, schrieb Klaus Birken:
>> Hi,
>>
>> I just upgraded to xtend 2.2 and experience the following (minor) issue.
>>
>> In my xtend class, I am using the "it" special variable in combination
>> with a switch-to-subclass expression (TBase and TSome are EMF classes
>> and TBase is base class of TSome):
>>
>> def generate(TBase it) {
>> switch (it) {
>> TSome: name + " because " + purpose
>> // ...
>> }
>> }
>>
>>
>> name is an attribute of the base class TBase and works fine. purpose is
>> an attribute of TSome, this gives an error marker Couldn't resolve
>> reference to JvmIdentifiableElement 'purpose'. This can be fixed by
>> explicitly using it.purpose.
>>
>> I don't know what is intended here, but I guess the behavior changed
>> from 2.1 to 2.2.
>>
>> Regards,
>> Klaus
>>
>
>
Previous Topic:What is new in Xtext 2.2.0 ?
Next Topic:[Xtext 2.2] NPE in JvmMemberRenameStrategy in a JDT project
Goto Forum:
  


Current Time: Fri Apr 19 23:28:14 GMT 2024

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

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

Back to the top