[Xcore] Declaring (in op) a local variable of generic type [message #1608915] |
Mon, 09 February 2015 21:13 |
Erick Hagstrom Messages: 107 Registered: April 2014 Location: USA |
Senior Member |
|
|
I'm trying to write a method that returns an instance of a generic type. So, early in my method, I try to declare a local variable of that type, intending to assign it and return it later. But the Xcore editor marks it as an error and tells me, "Couldn't resolve reference to JvmType 'T'." I at first thought this was an Xbase issue, but it seems not since I can do this in Xtend. Is this a bug, or am I doing something wrong?
Code, stripped of all meaning:
Here's the xcore op:
op <T, C> T somethingGeneric(C hiC)
{
var T myT
myT
}
And the xtend def:
def <T, C> T somethingGeneric(C hiC)
{
var T myT
myT
}
The Xtend editor has no problem with the def as written, but the Xcore editor can't figure out what 'T' represents.
|
|
|
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1610530 is a reply to message #1608915] |
Tue, 10 February 2015 21:27 |
Ed Merks Messages: 33224 Registered: July 2009 |
Senior Member |
|
|
Erick,
Which version of Xcore are you using? If it's the latest SR2 release,
or the Mars stream, please open a Bugzilla.
On 09.02.2015 22:13, Erick Hagstrom wrote:
> I'm trying to write a method that returns an instance of a generic type.
> So, early in my method, I try to declare a local variable of that type,
> intending to assign it and return it later. But the Xcore editor marks
> it as an error and tells me, "Couldn't resolve reference to JvmType
> 'T'." I at first thought this was an Xbase issue, but it seems not since
> I can do this in Xtend. Is this a bug, or am I doing something wrong?
>
> Code, stripped of all meaning:
>
> Here's the xcore op:
>
> op <T, C> T somethingGeneric(C hiC)
> {
> var T myT
> myT
> }
>
> And the xtend def:
>
> def <T, C> T somethingGeneric(C hiC)
> {
> var T myT
> myT
> }
>
> The Xtend editor has no problem with the def as written, but the Xcore
> editor can't figure out what 'T' represents.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03868 seconds