Generics of Custom Classes, How to?

Monkey Forums/Monkey Programming/Generics of Custom Classes, How to?

Rixarn(Posted 2011) [#1]
Hi! I'm a bit confused about generics.

This works:

...
Local obj:Object = new Test<Int>()
Local t:Test<Int> = Test<Int>(obj)
...
Class Test<T>
End


But this doesnt:
...
Local obj:Object = new Test<Image>()
Local t:Test<Image> = Test<Image>(obj)
...
Class Test<T>
End


I get a Error : Identifier 'Test' not found.

What i'm doing wrong? Thanks!


Samah(Posted 2011) [#2]
Looks like a bug to me. At first I thought maybe you weren't importing mojo, but my test confirmed your problem.

Just to prove it's not something to do with it being a Mojo class, I tried this (which also fails).
Class Test<T>
End

Class Foo	
End

Function Main:Int()
	Local obj:Object = new Test<Foo>()
	Local t:Test<Foo> = Test<Foo>(obj)
	Return 0
End


Might want to repost this in the Bugs forum.


Rixarn(Posted 2011) [#3]
Done! Hope mark sees it soon :)